/**
 *
 */
import Util;
import OSS;
import OpenPlatform;
import OSSUtil;
import FileForm;
import Number;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  
  checkConfig(config);
  @endpoint = getEndpoint('imageprocess', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AnalyzeChestVesselRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.'),
  dataSourceType?: string(name='DataSourceType', description='This parameter is required.'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  URLList?: [ 
    {
      URL?: string(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='1

This parameter is required.'),
}

model AnalyzeChestVesselAdvanceRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.'),
  dataSourceType?: string(name='DataSourceType', description='This parameter is required.'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  URLList?: [ 
    {
      URLObject?: readable(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='1

This parameter is required.'),
}

model AnalyzeChestVesselResponseBody = {
  data?: {
    aortaInfo?: {
      area?: [ float ](name='Area', description='1'),
      coordinates?: [[ float ]      ](name='Coordinates'),
      labelValue?: long(name='LabelValue', example='2'),
      maxArea?: float(name='MaxArea', example='2722'),
      maxAreaIndex?: long(name='MaxAreaIndex', example='416'),
      maxDiameter?: float(name='MaxDiameter', example='63'),
    }(name='AortaInfo'),
    pulmonaryInfo?: {
      area?: [ float ](name='Area', description='1'),
      coordinates?: [[ float ]      ](name='Coordinates'),
      labelValue?: long(name='LabelValue', example='1'),
      maxArea?: float(name='MaxArea', example='928'),
      maxAreaIndex?: long(name='MaxAreaIndex', example='0'),
      maxDiameter?: float(name='MaxDiameter', example='42'),
      nearestAortaArea?: float(name='NearestAortaArea', example='2439'),
    }(name='PulmonaryInfo'),
    resultURL?: string(name='ResultURL', example='http://vibktprfx-prod-prod-aic-med-cn-shanghai.oss-cn-shanghai.aliyuncs.com/ct_artery_aa_ph/local_test/2021-07-08/6C4713DF-F548-47DF-A456-5DA1C8334444_result_compressed.tgz?Expires=1625732732&OSSAccessKeyId=LTAI4FoLmvQ9urWXgSR****&Signature=5UKVmLfM7GWllIcPr9a6dKz%2B5h****'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='B87D013B-F25F-47DC-ABE1-440F4837AFD2'),
}

model AnalyzeChestVesselResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AnalyzeChestVesselResponseBody(name='body'),
}

/**
 * @summary 主动脉瘤肺动脉高压检测
 *
 * @param request AnalyzeChestVesselRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AnalyzeChestVesselResponse
 */
async function analyzeChestVesselWithOptions(request: AnalyzeChestVesselRequest, runtime: Util.RuntimeOptions): AnalyzeChestVesselResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.dataFormat)) {
    body['DataFormat'] = request.dataFormat;
  }
  if (!Util.isUnset(request.dataSourceType)) {
    body['DataSourceType'] = request.dataSourceType;
  }
  if (!Util.isUnset(request.orgId)) {
    body['OrgId'] = request.orgId;
  }
  if (!Util.isUnset(request.orgName)) {
    body['OrgName'] = request.orgName;
  }
  if (!Util.isUnset(request.URLList)) {
    body['URLList'] = request.URLList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'AnalyzeChestVessel',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 主动脉瘤肺动脉高压检测
 *
 * @param request AnalyzeChestVesselRequest
 * @return AnalyzeChestVesselResponse
 */
async function analyzeChestVessel(request: AnalyzeChestVesselRequest): AnalyzeChestVesselResponse {
  var runtime = new Util.RuntimeOptions{};
  return analyzeChestVesselWithOptions(request, runtime);
}

async function analyzeChestVesselAdvance(request: AnalyzeChestVesselAdvanceRequest, runtime: Util.RuntimeOptions): AnalyzeChestVesselResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'imageprocess',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var analyzeChestVesselReq = new AnalyzeChestVesselRequest{};
  OpenApiUtil.convert(request, analyzeChestVesselReq);

  if(!Util.isUnset(request.URLList)) {
    var i0 : integer = 0;
    for (var item0 : request.URLList) {
      if(!Util.isUnset(item0.URLObject)) {
        authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
        ossConfig.accessKeyId = authResponse.body.accessKeyId;
        ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
        ossClient = new OSS(ossConfig);

        fileObj = new FileForm.FileField{
          filename = authResponse.body.objectKey,
          content = item0.URLObject,
          contentType = '',
        };
        ossHeader = new OSS.PostObjectRequest.header{
          accessKeyId = authResponse.body.accessKeyId,
          policy = authResponse.body.encodedPolicy,
          signature = authResponse.body.signature,
          key = authResponse.body.objectKey,
          file = fileObj,
          successActionStatus = '201',
        };
        uploadRequest = new OSS.PostObjectRequest{
          bucketName = authResponse.body.bucket,
          header = ossHeader,
        };
        ossClient.postObject(uploadRequest, ossRuntime);
        var tmp : AnalyzeChestVesselRequest.URLList = analyzeChestVesselReq.URLList[i0];
        tmp.URL = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
        i0 = Number.ltoi(Number.add(Number.itol(i0), Number.itol(1)));
      }
    }
  }
  var analyzeChestVesselResp = analyzeChestVesselWithOptions(analyzeChestVesselReq, runtime);
  return analyzeChestVesselResp;
}

model CalcBMDRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  sourceType?: string(name='SourceType', description='This parameter is required.', example='HTTP_FILES'),
  URLList?: [ 
    {
      URL?: string(name='URL', description='This parameter is required.', example='https://medclients-sh.oss-cn-shanghai.aliyuncs.com/demo/xxx/0001.dcm'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model CalcBMDAdvanceRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  sourceType?: string(name='SourceType', description='This parameter is required.', example='HTTP_FILES'),
  URLList?: [ 
    {
      URLObject?: readable(name='URL', description='This parameter is required.', example='https://medclients-sh.oss-cn-shanghai.aliyuncs.com/demo/xxx/0001.dcm'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model CalcBMDResponseBody = {
  data?: {
    detections?: [ 
      {
        vertBMD?: float(name='VertBMD', example='0.78'),
        vertCategory?: float(name='VertCategory', example='NaN'),
        vertId?: string(name='VertId', example='L1'),
        vertTScore?: float(name='VertTScore', example='-2.5'),
        vertZScore?: float(name='VertZScore', example='NaN'),
      }
    ](name='Detections'),
    origin?: [ float ](name='Origin'),
    resultURL?: string(name='ResultURL', example='http://vibktprfx-prod-prod-aic-med-cn-shanghai.oss-cn-shanghai.aliyuncs.com/calc-bmd/local_test/2023-03-31/7772ECE3-22A7-193F-81B4-B0D6A02B5DAF-result.tgz?Expires=1680486509&amp;OSSAccessKeyId=LTAI4FoLmvQ9urWXgSRp****&amp;Signature=GWi%2BhCCtamefKVYiS9oZJduswH****'),
    spacing?: [ float ](name='Spacing'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='B48DECE6-29FE-1967-92F1-2E072873851A'),
}

model CalcBMDResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CalcBMDResponseBody(name='body'),
}

/**
 * @summary 骨密度估计
 *
 * @param request CalcBMDRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CalcBMDResponse
 */
async function calcBMDWithOptions(request: CalcBMDRequest, runtime: Util.RuntimeOptions): CalcBMDResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.dataFormat)) {
    body['DataFormat'] = request.dataFormat;
  }
  if (!Util.isUnset(request.orgId)) {
    body['OrgId'] = request.orgId;
  }
  if (!Util.isUnset(request.orgName)) {
    body['OrgName'] = request.orgName;
  }
  if (!Util.isUnset(request.sourceType)) {
    body['SourceType'] = request.sourceType;
  }
  if (!Util.isUnset(request.URLList)) {
    body['URLList'] = request.URLList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CalcBMD',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 骨密度估计
 *
 * @param request CalcBMDRequest
 * @return CalcBMDResponse
 */
async function calcBMD(request: CalcBMDRequest): CalcBMDResponse {
  var runtime = new Util.RuntimeOptions{};
  return calcBMDWithOptions(request, runtime);
}

async function calcBMDAdvance(request: CalcBMDAdvanceRequest, runtime: Util.RuntimeOptions): CalcBMDResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'imageprocess',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var calcBMDReq = new CalcBMDRequest{};
  OpenApiUtil.convert(request, calcBMDReq);

  if(!Util.isUnset(request.URLList)) {
    var i0 : integer = 0;
    for (var item0 : request.URLList) {
      if(!Util.isUnset(item0.URLObject)) {
        authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
        ossConfig.accessKeyId = authResponse.body.accessKeyId;
        ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
        ossClient = new OSS(ossConfig);

        fileObj = new FileForm.FileField{
          filename = authResponse.body.objectKey,
          content = item0.URLObject,
          contentType = '',
        };
        ossHeader = new OSS.PostObjectRequest.header{
          accessKeyId = authResponse.body.accessKeyId,
          policy = authResponse.body.encodedPolicy,
          signature = authResponse.body.signature,
          key = authResponse.body.objectKey,
          file = fileObj,
          successActionStatus = '201',
        };
        uploadRequest = new OSS.PostObjectRequest{
          bucketName = authResponse.body.bucket,
          header = ossHeader,
        };
        ossClient.postObject(uploadRequest, ossRuntime);
        var tmp : CalcBMDRequest.URLList = calcBMDReq.URLList[i0];
        tmp.URL = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
        i0 = Number.ltoi(Number.add(Number.itol(i0), Number.itol(1)));
      }
    }
  }
  var calcBMDResp = calcBMDWithOptions(calcBMDReq, runtime);
  return calcBMDResp;
}

model CalcCACSRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.'),
  dataSourceType?: string(name='DataSourceType', description='This parameter is required.'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  URLList?: [ 
    {
      URL?: string(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model CalcCACSAdvanceRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.'),
  dataSourceType?: string(name='DataSourceType', description='This parameter is required.'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  URLList?: [ 
    {
      URLObject?: readable(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model CalcCACSResponseBody = {
  data?: {
    detections?: [ 
      {
        calciumCenter?: [ long ](name='CalciumCenter'),
        calciumId?: long(name='CalciumId', example='1'),
        calciumScore?: float(name='CalciumScore', example='19.22474'),
        calciumVolume?: float(name='CalciumVolume', example='28.837109'),
      }
    ](name='Detections'),
    resultUrl?: string(name='ResultUrl', example='http://vibktprfx-prod-prod-aic-med-cn-shanghai.oss-cn-shanghai.aliyuncs.com/calc-cacs/2020-09-29/2020-09-29-11%3A07%3A41-D74FE0DF-8F80-41EB-B08B-2E67053587EC.tar.gz?Expires=1601350661&OSSAccessKeyId=LTAI4FoLmvQ9urWXgSRp****&Signature=iB16ms28Y5mzB11ghYUd7upCi4****'),
    score?: string(name='Score', example='117.61'),
    volumeScore?: string(name='VolumeScore', example='111.96'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='6797D285-9290-4FBB-9742-AA1E286EF3B9'),
}

model CalcCACSResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CalcCACSResponseBody(name='body'),
}

/**
 * @param request CalcCACSRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CalcCACSResponse
 */
async function calcCACSWithOptions(request: CalcCACSRequest, runtime: Util.RuntimeOptions): CalcCACSResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.dataFormat)) {
    body['DataFormat'] = request.dataFormat;
  }
  if (!Util.isUnset(request.dataSourceType)) {
    body['DataSourceType'] = request.dataSourceType;
  }
  if (!Util.isUnset(request.orgId)) {
    body['OrgId'] = request.orgId;
  }
  if (!Util.isUnset(request.orgName)) {
    body['OrgName'] = request.orgName;
  }
  if (!Util.isUnset(request.URLList)) {
    body['URLList'] = request.URLList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CalcCACS',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request CalcCACSRequest
 * @return CalcCACSResponse
 */
async function calcCACS(request: CalcCACSRequest): CalcCACSResponse {
  var runtime = new Util.RuntimeOptions{};
  return calcCACSWithOptions(request, runtime);
}

async function calcCACSAdvance(request: CalcCACSAdvanceRequest, runtime: Util.RuntimeOptions): CalcCACSResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'imageprocess',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var calcCACSReq = new CalcCACSRequest{};
  OpenApiUtil.convert(request, calcCACSReq);

  if(!Util.isUnset(request.URLList)) {
    var i0 : integer = 0;
    for (var item0 : request.URLList) {
      if(!Util.isUnset(item0.URLObject)) {
        authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
        ossConfig.accessKeyId = authResponse.body.accessKeyId;
        ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
        ossClient = new OSS(ossConfig);

        fileObj = new FileForm.FileField{
          filename = authResponse.body.objectKey,
          content = item0.URLObject,
          contentType = '',
        };
        ossHeader = new OSS.PostObjectRequest.header{
          accessKeyId = authResponse.body.accessKeyId,
          policy = authResponse.body.encodedPolicy,
          signature = authResponse.body.signature,
          key = authResponse.body.objectKey,
          file = fileObj,
          successActionStatus = '201',
        };
        uploadRequest = new OSS.PostObjectRequest{
          bucketName = authResponse.body.bucket,
          header = ossHeader,
        };
        ossClient.postObject(uploadRequest, ossRuntime);
        var tmp : CalcCACSRequest.URLList = calcCACSReq.URLList[i0];
        tmp.URL = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
        i0 = Number.ltoi(Number.add(Number.itol(i0), Number.itol(1)));
      }
    }
  }
  var calcCACSResp = calcCACSWithOptions(calcCACSReq, runtime);
  return calcCACSResp;
}

model DetectCovid19CadRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='0001'),
  orgName?: string(name='OrgName', description='This parameter is required.', example='weiyi'),
  URLList?: [ 
    {
      URL?: string(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model DetectCovid19CadAdvanceRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='0001'),
  orgName?: string(name='OrgName', description='This parameter is required.', example='weiyi'),
  URLList?: [ 
    {
      URLObject?: readable(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model DetectCovid19CadResponseBody = {
  data?: {
    lesionRatio?: string(name='LesionRatio', example='0.9387283236994219'),
    mask?: string(name='Mask', example='http://algo-app-aic-med-cn-shanghai-prod.oss-cn-shanghai.aliyuncs.com/covid19-dcm/unspecified/2020032702/1b1e1018-6fcf-11ea-8fa1-d20b34387541.nii.gz?Expires=1585276394&OSSAccessKeyId=LTAI4FoLmvQ9urWXgSRp****&Signature=%2F1LNGWJUqvY0VRYGgg8Ldtb3BF****'),
    newProbability?: string(name='NewProbability', example='4.062644e-06'),
    normalProbability?: string(name='NormalProbability', example='0.7230905'),
    otherProbability?: string(name='OtherProbability', example='0.27690542'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='7CB9B663-3EF8-4C9C-A464-FDA2B5F1E3A4'),
}

model DetectCovid19CadResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DetectCovid19CadResponseBody(name='body'),
}

/**
 * @param request DetectCovid19CadRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DetectCovid19CadResponse
 */
async function detectCovid19CadWithOptions(request: DetectCovid19CadRequest, runtime: Util.RuntimeOptions): DetectCovid19CadResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.dataFormat)) {
    body['DataFormat'] = request.dataFormat;
  }
  if (!Util.isUnset(request.orgId)) {
    body['OrgId'] = request.orgId;
  }
  if (!Util.isUnset(request.orgName)) {
    body['OrgName'] = request.orgName;
  }
  if (!Util.isUnset(request.URLList)) {
    body['URLList'] = request.URLList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DetectCovid19Cad',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request DetectCovid19CadRequest
 * @return DetectCovid19CadResponse
 */
async function detectCovid19Cad(request: DetectCovid19CadRequest): DetectCovid19CadResponse {
  var runtime = new Util.RuntimeOptions{};
  return detectCovid19CadWithOptions(request, runtime);
}

async function detectCovid19CadAdvance(request: DetectCovid19CadAdvanceRequest, runtime: Util.RuntimeOptions): DetectCovid19CadResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'imageprocess',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var detectCovid19CadReq = new DetectCovid19CadRequest{};
  OpenApiUtil.convert(request, detectCovid19CadReq);

  if(!Util.isUnset(request.URLList)) {
    var i0 : integer = 0;
    for (var item0 : request.URLList) {
      if(!Util.isUnset(item0.URLObject)) {
        authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
        ossConfig.accessKeyId = authResponse.body.accessKeyId;
        ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
        ossClient = new OSS(ossConfig);

        fileObj = new FileForm.FileField{
          filename = authResponse.body.objectKey,
          content = item0.URLObject,
          contentType = '',
        };
        ossHeader = new OSS.PostObjectRequest.header{
          accessKeyId = authResponse.body.accessKeyId,
          policy = authResponse.body.encodedPolicy,
          signature = authResponse.body.signature,
          key = authResponse.body.objectKey,
          file = fileObj,
          successActionStatus = '201',
        };
        uploadRequest = new OSS.PostObjectRequest{
          bucketName = authResponse.body.bucket,
          header = ossHeader,
        };
        ossClient.postObject(uploadRequest, ossRuntime);
        var tmp : DetectCovid19CadRequest.URLList = detectCovid19CadReq.URLList[i0];
        tmp.URL = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
        i0 = Number.ltoi(Number.add(Number.itol(i0), Number.itol(1)));
      }
    }
  }
  var detectCovid19CadResp = detectCovid19CadWithOptions(detectCovid19CadReq, runtime);
  return detectCovid19CadResp;
}

model DetectLiverSteatosisRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  sourceType?: string(name='SourceType', description='This parameter is required.', example='HTTP_FILES'),
  URLList?: [ 
    {
      URL?: string(name='URL', description='This parameter is required.', example='https://medclients-sh.oss-cn-shanghai.aliyuncs.com/demo/xxx/0001.dcm'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model DetectLiverSteatosisAdvanceRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  sourceType?: string(name='SourceType', description='This parameter is required.', example='HTTP_FILES'),
  URLList?: [ 
    {
      URLObject?: readable(name='URL', description='This parameter is required.', example='https://medclients-sh.oss-cn-shanghai.aliyuncs.com/demo/xxx/0001.dcm'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model DetectLiverSteatosisResponseBody = {
  data?: {
    detections?: [ 
      {
        fatFract?: double(name='FatFract'),
        liverHU?: float(name='LiverHU', example='62.07644147383561'),
        liverROI1?: float(name='LiverROI1', example='63.50222396850586'),
        liverROI2?: float(name='LiverROI2', example='62.23713684082031'),
        liverROI3?: float(name='LiverROI3', example='59.78181838989258'),
        liverSlice?: float(name='LiverSlice', example='12.0'),
        liverSpleenDifference?: float(name='LiverSpleenDifference', example='8.206502275265478'),
        liverSpleenRatio?: float(name='LiverSpleenRatio', example='1.15233917834983'),
        liverVolume?: float(name='LiverVolume', example='1059.4175610625439'),
        maossScore?: double(name='MaossScore'),
        prediction?: string(name='Prediction', example='Mod'),
        probability?: float(name='Probability', example='0.9457855224609375'),
        ROI1Center?: [ long ](name='ROI1Center'),
        ROI2Center?: [ long ](name='ROI2Center'),
        ROI3Center?: [ long ](name='ROI3Center'),
        radius?: long(name='Radius', example='1.0'),
        spleenCenter?: [ long ](name='SpleenCenter'),
        spleenHU?: float(name='SpleenHU', example='53.86993919857013'),
        spleenROI?: float(name='SpleenROI', example='50.553409576416016'),
        spleenSlice?: float(name='SpleenSlice', example='9.0'),
        spleenVolume?: float(name='SpleenVolume', example='156.01873229470647'),
      }
    ](name='Detections'),
    origin?: [ float ](name='Origin'),
    resultUrl?: string(name='ResultUrl'),
    spacing?: [ float ](name='Spacing'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='39C848F7-D814-1A06-AE0D-AFC706B9700F'),
}

model DetectLiverSteatosisResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DetectLiverSteatosisResponseBody(name='body'),
}

/**
 * @summary 脂肪肝检测
 *
 * @param request DetectLiverSteatosisRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DetectLiverSteatosisResponse
 */
async function detectLiverSteatosisWithOptions(request: DetectLiverSteatosisRequest, runtime: Util.RuntimeOptions): DetectLiverSteatosisResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.dataFormat)) {
    body['DataFormat'] = request.dataFormat;
  }
  if (!Util.isUnset(request.orgId)) {
    body['OrgId'] = request.orgId;
  }
  if (!Util.isUnset(request.orgName)) {
    body['OrgName'] = request.orgName;
  }
  if (!Util.isUnset(request.sourceType)) {
    body['SourceType'] = request.sourceType;
  }
  if (!Util.isUnset(request.URLList)) {
    body['URLList'] = request.URLList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DetectLiverSteatosis',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 脂肪肝检测
 *
 * @param request DetectLiverSteatosisRequest
 * @return DetectLiverSteatosisResponse
 */
async function detectLiverSteatosis(request: DetectLiverSteatosisRequest): DetectLiverSteatosisResponse {
  var runtime = new Util.RuntimeOptions{};
  return detectLiverSteatosisWithOptions(request, runtime);
}

async function detectLiverSteatosisAdvance(request: DetectLiverSteatosisAdvanceRequest, runtime: Util.RuntimeOptions): DetectLiverSteatosisResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'imageprocess',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var detectLiverSteatosisReq = new DetectLiverSteatosisRequest{};
  OpenApiUtil.convert(request, detectLiverSteatosisReq);

  if(!Util.isUnset(request.URLList)) {
    var i0 : integer = 0;
    for (var item0 : request.URLList) {
      if(!Util.isUnset(item0.URLObject)) {
        authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
        ossConfig.accessKeyId = authResponse.body.accessKeyId;
        ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
        ossClient = new OSS(ossConfig);

        fileObj = new FileForm.FileField{
          filename = authResponse.body.objectKey,
          content = item0.URLObject,
          contentType = '',
        };
        ossHeader = new OSS.PostObjectRequest.header{
          accessKeyId = authResponse.body.accessKeyId,
          policy = authResponse.body.encodedPolicy,
          signature = authResponse.body.signature,
          key = authResponse.body.objectKey,
          file = fileObj,
          successActionStatus = '201',
        };
        uploadRequest = new OSS.PostObjectRequest{
          bucketName = authResponse.body.bucket,
          header = ossHeader,
        };
        ossClient.postObject(uploadRequest, ossRuntime);
        var tmp : DetectLiverSteatosisRequest.URLList = detectLiverSteatosisReq.URLList[i0];
        tmp.URL = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
        i0 = Number.ltoi(Number.add(Number.itol(i0), Number.itol(1)));
      }
    }
  }
  var detectLiverSteatosisResp = detectLiverSteatosisWithOptions(detectLiverSteatosisReq, runtime);
  return detectLiverSteatosisResp;
}

model DetectLungNoduleRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='0001'),
  orgName?: string(name='OrgName', description='This parameter is required.', example='weiyi'),
  threshold?: float(name='Threshold', example='0.60'),
  URLList?: [ 
    {
      URL?: string(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='1

This parameter is required.'),
}

model DetectLungNoduleAdvanceRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='0001'),
  orgName?: string(name='OrgName', description='This parameter is required.', example='weiyi'),
  threshold?: float(name='Threshold', example='0.60'),
  URLList?: [ 
    {
      URLObject?: readable(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='1

This parameter is required.'),
}

model DetectLungNoduleResponseBody = {
  data?: {
    series?: [ 
      {
        elements?: [ 
          {
            category?: string(name='Category', example='1'),
            confidence?: float(name='Confidence', example='0.7012705768508907'),
            diameter?: float(name='Diameter', example='9.730626493692398'),
            imageX?: float(name='ImageX', example='308.9676976455463'),
            imageY?: float(name='ImageY', example='198.3552282631497'),
            imageZ?: float(name='ImageZ', example='20.434030793471255'),
            lobe?: string(name='Lobe', example='up'),
            lung?: string(name='Lung', example='left'),
            majorAxis?: [ float ](name='MajorAxis'),
            meanValue?: float(name='MeanValue', example='261.37589112119247'),
            minorAxis?: [ float ](name='MinorAxis'),
            recistSOPInstanceUID?: string(name='RecistSOPInstanceUID', description='结节最大径位置所在帧的ID标识。', example='1.3.6.1.4.1.14519.5.2.1.6279.6001.468208655866166788627471660948'),
            risk?: float(name='Risk', description='结节为恶性的置信度。取值范围0~1。', example='0.173'),
            SOPInstanceUID?: string(name='SOPInstanceUID', example='1.3.6.1.4.1.14519.5.2.1.6279.6001.261151233960269013402330853013'),
            volume?: float(name='Volume', example='10959.220491175074'),
            x?: float(name='X', example='51.24291240631416'),
            y?: float(name='Y', example='-32.23147700784307'),
            z?: float(name='Z', example='-46.81608170781766'),
          }
        ](name='Elements'),
        origin?: [ float ](name='Origin', description='1'),
        report?: string(name='Report'),
        seriesInstanceUid?: string(name='SeriesInstanceUid', example='1.3.6.1.4.1.14519.5.2.1.6279.6001.179049373636438705059720603192'),
        spacing?: [ float ](name='Spacing', description='1'),
      }
    ](name='Series'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='9889ef5b-b973-4dd0-9f26-3b9cc489c436'),
}

model DetectLungNoduleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DetectLungNoduleResponseBody(name='body'),
}

/**
 * @param request DetectLungNoduleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DetectLungNoduleResponse
 */
async function detectLungNoduleWithOptions(request: DetectLungNoduleRequest, runtime: Util.RuntimeOptions): DetectLungNoduleResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.dataFormat)) {
    body['DataFormat'] = request.dataFormat;
  }
  if (!Util.isUnset(request.orgId)) {
    body['OrgId'] = request.orgId;
  }
  if (!Util.isUnset(request.orgName)) {
    body['OrgName'] = request.orgName;
  }
  if (!Util.isUnset(request.threshold)) {
    body['Threshold'] = request.threshold;
  }
  if (!Util.isUnset(request.URLList)) {
    body['URLList'] = request.URLList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DetectLungNodule',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request DetectLungNoduleRequest
 * @return DetectLungNoduleResponse
 */
async function detectLungNodule(request: DetectLungNoduleRequest): DetectLungNoduleResponse {
  var runtime = new Util.RuntimeOptions{};
  return detectLungNoduleWithOptions(request, runtime);
}

async function detectLungNoduleAdvance(request: DetectLungNoduleAdvanceRequest, runtime: Util.RuntimeOptions): DetectLungNoduleResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'imageprocess',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var detectLungNoduleReq = new DetectLungNoduleRequest{};
  OpenApiUtil.convert(request, detectLungNoduleReq);

  if(!Util.isUnset(request.URLList)) {
    var i0 : integer = 0;
    for (var item0 : request.URLList) {
      if(!Util.isUnset(item0.URLObject)) {
        authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
        ossConfig.accessKeyId = authResponse.body.accessKeyId;
        ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
        ossClient = new OSS(ossConfig);

        fileObj = new FileForm.FileField{
          filename = authResponse.body.objectKey,
          content = item0.URLObject,
          contentType = '',
        };
        ossHeader = new OSS.PostObjectRequest.header{
          accessKeyId = authResponse.body.accessKeyId,
          policy = authResponse.body.encodedPolicy,
          signature = authResponse.body.signature,
          key = authResponse.body.objectKey,
          file = fileObj,
          successActionStatus = '201',
        };
        uploadRequest = new OSS.PostObjectRequest{
          bucketName = authResponse.body.bucket,
          header = ossHeader,
        };
        ossClient.postObject(uploadRequest, ossRuntime);
        var tmp : DetectLungNoduleRequest.URLList = detectLungNoduleReq.URLList[i0];
        tmp.URL = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
        i0 = Number.ltoi(Number.add(Number.itol(i0), Number.itol(1)));
      }
    }
  }
  var detectLungNoduleResp = detectLungNoduleWithOptions(detectLungNoduleReq, runtime);
  return detectLungNoduleResp;
}

model DetectLymphRequest {
  dataSourceType?: string(name='DataSourceType', description='This parameter is required.', example='HTTP_FILES'),
  URLList?: [ 
    {
      URL?: string(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model DetectLymphAdvanceRequest {
  dataSourceType?: string(name='DataSourceType', description='This parameter is required.', example='HTTP_FILES'),
  URLList?: [ 
    {
      URLObject?: readable(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model DetectLymphResponseBody = {
  data?: {
    lesions?: [ 
      {
        boxes?: [ float ](name='Boxes'),
        diametermm?: [ float ](name='Diametermm'),
        keySlice?: long(name='KeySlice', example='7'),
        recist?: [[ float ]        ](name='Recist'),
        score?: float(name='Score', example='0.6298'),
      }
    ](name='Lesions'),
  }(name='Data'),
  message?: string(name='Message', description='提交异步任务后的提示信息。', example='该调用为异步调用，任务已提交成功，请以requestId的值作为jobId参数调用同类目下GetAsyncJobResult接口查询任务执行状态和结果。'),
  requestId?: string(name='RequestId', example='59598577-13C6-12A2-8CBF-A4DA4C9280A1'),
}

model DetectLymphResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DetectLymphResponseBody(name='body'),
}

/**
 * @summary 淋巴结检测
 *
 * @param request DetectLymphRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DetectLymphResponse
 */
async function detectLymphWithOptions(request: DetectLymphRequest, runtime: Util.RuntimeOptions): DetectLymphResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.dataSourceType)) {
    body['DataSourceType'] = request.dataSourceType;
  }
  if (!Util.isUnset(request.URLList)) {
    body['URLList'] = request.URLList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DetectLymph',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 淋巴结检测
 *
 * @param request DetectLymphRequest
 * @return DetectLymphResponse
 */
async function detectLymph(request: DetectLymphRequest): DetectLymphResponse {
  var runtime = new Util.RuntimeOptions{};
  return detectLymphWithOptions(request, runtime);
}

async function detectLymphAdvance(request: DetectLymphAdvanceRequest, runtime: Util.RuntimeOptions): DetectLymphResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'imageprocess',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var detectLymphReq = new DetectLymphRequest{};
  OpenApiUtil.convert(request, detectLymphReq);

  if(!Util.isUnset(request.URLList)) {
    var i0 : integer = 0;
    for (var item0 : request.URLList) {
      if(!Util.isUnset(item0.URLObject)) {
        authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
        ossConfig.accessKeyId = authResponse.body.accessKeyId;
        ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
        ossClient = new OSS(ossConfig);

        fileObj = new FileForm.FileField{
          filename = authResponse.body.objectKey,
          content = item0.URLObject,
          contentType = '',
        };
        ossHeader = new OSS.PostObjectRequest.header{
          accessKeyId = authResponse.body.accessKeyId,
          policy = authResponse.body.encodedPolicy,
          signature = authResponse.body.signature,
          key = authResponse.body.objectKey,
          file = fileObj,
          successActionStatus = '201',
        };
        uploadRequest = new OSS.PostObjectRequest{
          bucketName = authResponse.body.bucket,
          header = ossHeader,
        };
        ossClient.postObject(uploadRequest, ossRuntime);
        var tmp : DetectLymphRequest.URLList = detectLymphReq.URLList[i0];
        tmp.URL = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
        i0 = Number.ltoi(Number.add(Number.itol(i0), Number.itol(1)));
      }
    }
  }
  var detectLymphResp = detectLymphWithOptions(detectLymphReq, runtime);
  return detectLymphResp;
}

model DetectPancRequest {
  dataSourceType?: string(name='DataSourceType', description='This parameter is required.', example='HTTP_FILES'),
  URLList?: [ 
    {
      URL?: string(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model DetectPancAdvanceRequest {
  dataSourceType?: string(name='DataSourceType', description='This parameter is required.', example='HTTP_FILES'),
  URLList?: [ 
    {
      URLObject?: readable(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model DetectPancResponseBody = {
  data?: {
    lesion?: {
      mask?: string(name='Mask', example='http://vibktprfx-prod-prod-aic-med-cn-shanghai.oss-cn-shanghai.aliyuncs.com/screen-pdac/2022-05-25_14%3A33%3A30/4CA2BF25-BCDB-9C6C-B14C-EB41E8266588.nii.gz?Expires=1653462210&OSSAccessKeyId=LTAI4FoLmvQ9urWXgSR****&Signature=8t%2FknUrQyyyCU2p7QhMC%2BXBCR****'),
      nonPdacVol?: string(name='NonPdacVol', example='0'),
      pancVol?: string(name='PancVol', example='0'),
      pdacVol?: string(name='PdacVol', example='0'),
      possibilities?: [ string ](name='Possibilities'),
    }(name='Lesion'),
  }(name='Data'),
  message?: string(name='Message', description='提交异步任务后的提示信息。', example='该调用为异步调用，任务已提交成功，请以requestId的值作为jobId参数调用同类目下GetAsyncJobResult接口查询任务执行状态和结果。'),
  requestId?: string(name='RequestId', example='CA1C672A-4F85-1CD9-893D-3434C924C4B2'),
}

model DetectPancResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DetectPancResponseBody(name='body'),
}

/**
 * @summary 胰腺癌检测
 *
 * @param request DetectPancRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DetectPancResponse
 */
async function detectPancWithOptions(request: DetectPancRequest, runtime: Util.RuntimeOptions): DetectPancResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.dataSourceType)) {
    body['DataSourceType'] = request.dataSourceType;
  }
  if (!Util.isUnset(request.URLList)) {
    body['URLList'] = request.URLList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DetectPanc',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 胰腺癌检测
 *
 * @param request DetectPancRequest
 * @return DetectPancResponse
 */
async function detectPanc(request: DetectPancRequest): DetectPancResponse {
  var runtime = new Util.RuntimeOptions{};
  return detectPancWithOptions(request, runtime);
}

async function detectPancAdvance(request: DetectPancAdvanceRequest, runtime: Util.RuntimeOptions): DetectPancResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'imageprocess',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var detectPancReq = new DetectPancRequest{};
  OpenApiUtil.convert(request, detectPancReq);

  if(!Util.isUnset(request.URLList)) {
    var i0 : integer = 0;
    for (var item0 : request.URLList) {
      if(!Util.isUnset(item0.URLObject)) {
        authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
        ossConfig.accessKeyId = authResponse.body.accessKeyId;
        ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
        ossClient = new OSS(ossConfig);

        fileObj = new FileForm.FileField{
          filename = authResponse.body.objectKey,
          content = item0.URLObject,
          contentType = '',
        };
        ossHeader = new OSS.PostObjectRequest.header{
          accessKeyId = authResponse.body.accessKeyId,
          policy = authResponse.body.encodedPolicy,
          signature = authResponse.body.signature,
          key = authResponse.body.objectKey,
          file = fileObj,
          successActionStatus = '201',
        };
        uploadRequest = new OSS.PostObjectRequest{
          bucketName = authResponse.body.bucket,
          header = ossHeader,
        };
        ossClient.postObject(uploadRequest, ossRuntime);
        var tmp : DetectPancRequest.URLList = detectPancReq.URLList[i0];
        tmp.URL = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
        i0 = Number.ltoi(Number.add(Number.itol(i0), Number.itol(1)));
      }
    }
  }
  var detectPancResp = detectPancWithOptions(detectPancReq, runtime);
  return detectPancResp;
}

model DetectRibFractureRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  sourceType?: string(name='SourceType', description='This parameter is required.'),
  URLList?: [ 
    {
      URL?: string(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model DetectRibFractureAdvanceRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  sourceType?: string(name='SourceType', description='This parameter is required.'),
  URLList?: [ 
    {
      URLObject?: readable(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model DetectRibFractureResponseBody = {
  data?: {
    detections?: [ 
      {
        coordinateImage?: [ int32 ](name='CoordinateImage'),
        coordinates?: [ int32 ](name='Coordinates'),
        fracSOPInstanceUID?: string(name='FracSOPInstanceUID', example='None'),
        fractureCategory?: string(name='FractureCategory', example='1'),
        fractureConfidence?: float(name='FractureConfidence', example='0.7916666666666667'),
        fractureId?: int32(name='FractureId', example='2'),
        fractureLocation?: string(name='FractureLocation', example='L4'),
        fractureSegment?: long(name='FractureSegment', example='0'),
      }
    ](name='Detections'),
    origin?: [ float ](name='Origin'),
    resultURL?: string(name='ResultURL', example='http://vibktprfx-prod-prod-aic-med-cn-shanghai.oss-cn-shanghai.aliyuncs.com/detect-rib-fracture/local_test/2020-12-22/result-D5CD101C-F8E5-43CA-9E99-44C783B8F8BE.tar.gz?Expires=1608631727&OSSAccessKeyId=LTAI4FoLmvQ9urWXgSRp****&Signature=d6c32E1IB4b7Ayo1lpjs%2Bq3Ylv****'),
    spacing?: [ float ](name='Spacing'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='5C695B5D-41A6-4202-8BF7-E647698678DF'),
}

model DetectRibFractureResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DetectRibFractureResponseBody(name='body'),
}

/**
 * @param request DetectRibFractureRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DetectRibFractureResponse
 */
async function detectRibFractureWithOptions(request: DetectRibFractureRequest, runtime: Util.RuntimeOptions): DetectRibFractureResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.dataFormat)) {
    body['DataFormat'] = request.dataFormat;
  }
  if (!Util.isUnset(request.orgId)) {
    body['OrgId'] = request.orgId;
  }
  if (!Util.isUnset(request.orgName)) {
    body['OrgName'] = request.orgName;
  }
  if (!Util.isUnset(request.sourceType)) {
    body['SourceType'] = request.sourceType;
  }
  if (!Util.isUnset(request.URLList)) {
    body['URLList'] = request.URLList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DetectRibFracture',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request DetectRibFractureRequest
 * @return DetectRibFractureResponse
 */
async function detectRibFracture(request: DetectRibFractureRequest): DetectRibFractureResponse {
  var runtime = new Util.RuntimeOptions{};
  return detectRibFractureWithOptions(request, runtime);
}

async function detectRibFractureAdvance(request: DetectRibFractureAdvanceRequest, runtime: Util.RuntimeOptions): DetectRibFractureResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'imageprocess',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var detectRibFractureReq = new DetectRibFractureRequest{};
  OpenApiUtil.convert(request, detectRibFractureReq);

  if(!Util.isUnset(request.URLList)) {
    var i0 : integer = 0;
    for (var item0 : request.URLList) {
      if(!Util.isUnset(item0.URLObject)) {
        authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
        ossConfig.accessKeyId = authResponse.body.accessKeyId;
        ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
        ossClient = new OSS(ossConfig);

        fileObj = new FileForm.FileField{
          filename = authResponse.body.objectKey,
          content = item0.URLObject,
          contentType = '',
        };
        ossHeader = new OSS.PostObjectRequest.header{
          accessKeyId = authResponse.body.accessKeyId,
          policy = authResponse.body.encodedPolicy,
          signature = authResponse.body.signature,
          key = authResponse.body.objectKey,
          file = fileObj,
          successActionStatus = '201',
        };
        uploadRequest = new OSS.PostObjectRequest{
          bucketName = authResponse.body.bucket,
          header = ossHeader,
        };
        ossClient.postObject(uploadRequest, ossRuntime);
        var tmp : DetectRibFractureRequest.URLList = detectRibFractureReq.URLList[i0];
        tmp.URL = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
        i0 = Number.ltoi(Number.add(Number.itol(i0), Number.itol(1)));
      }
    }
  }
  var detectRibFractureResp = detectRibFractureWithOptions(detectRibFractureReq, runtime);
  return detectRibFractureResp;
}

model DetectSkinDiseaseRequest {
  orgId?: string(name='OrgId', description='This parameter is required.', example='0001'),
  orgName?: string(name='OrgName', description='This parameter is required.', example='demo'),
  url?: string(name='Url', description='This parameter is required.', example='http://viapi-test.oss-cn-shanghai.aliyuncs.com/viapi-3.0domepic/imageprocess/DetectSkinDisease/DetectSkinDisease1.png'),
}

model DetectSkinDiseaseAdvanceRequest {
  orgId?: string(name='OrgId', description='This parameter is required.', example='0001'),
  orgName?: string(name='OrgName', description='This parameter is required.', example='demo'),
  urlObject?: readable(name='Url', description='This parameter is required.', example='http://viapi-test.oss-cn-shanghai.aliyuncs.com/viapi-3.0domepic/imageprocess/DetectSkinDisease/DetectSkinDisease1.png'),
}

model DetectSkinDiseaseResponseBody = {
  data?: {
    bodyPart?: string(name='BodyPart', example='leg'),
    imageQuality?: float(name='ImageQuality', example='90.9812'),
    imageType?: string(name='ImageType', example='skin_lesion'),
    results?: map[string]any(name='Results'),
    resultsEnglish?: map[string]any(name='ResultsEnglish', example='"psoriasis": 0.998,                     "eczema_dermatitis": 0.0011,                     "lupus_erythematosus": 0.0004'),
  }(name='Data'),
  requestId?: string(name='RequestId', example='DE9ABC80-4DD4-4F1B-B95C-D0E438B8FE56'),
}

model DetectSkinDiseaseResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DetectSkinDiseaseResponseBody(name='body'),
}

/**
 * @param request DetectSkinDiseaseRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DetectSkinDiseaseResponse
 */
async function detectSkinDiseaseWithOptions(request: DetectSkinDiseaseRequest, runtime: Util.RuntimeOptions): DetectSkinDiseaseResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.orgId)) {
    body['OrgId'] = request.orgId;
  }
  if (!Util.isUnset(request.orgName)) {
    body['OrgName'] = request.orgName;
  }
  if (!Util.isUnset(request.url)) {
    body['Url'] = request.url;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DetectSkinDisease',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request DetectSkinDiseaseRequest
 * @return DetectSkinDiseaseResponse
 */
async function detectSkinDisease(request: DetectSkinDiseaseRequest): DetectSkinDiseaseResponse {
  var runtime = new Util.RuntimeOptions{};
  return detectSkinDiseaseWithOptions(request, runtime);
}

async function detectSkinDiseaseAdvance(request: DetectSkinDiseaseAdvanceRequest, runtime: Util.RuntimeOptions): DetectSkinDiseaseResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'imageprocess',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var detectSkinDiseaseReq = new DetectSkinDiseaseRequest{};
  OpenApiUtil.convert(request, detectSkinDiseaseReq);

  if(!Util.isUnset(request.urlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.urlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    detectSkinDiseaseReq.url = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var detectSkinDiseaseResp = detectSkinDiseaseWithOptions(detectSkinDiseaseReq, runtime);
  return detectSkinDiseaseResp;
}

model FeedbackSessionRequest {
  feedback?: string(name='Feedback', description='This parameter is required.'),
  sessionId?: string(name='SessionId', description='This parameter is required.', example='69675e9ddaea4b1ca8b9ddbafd02edc2'),
}

model FeedbackSessionResponseBody = {
  requestId?: string(name='RequestId', example='01E1BC28-9155-59F0-BA7E-3706170DEF1B'),
}

model FeedbackSessionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: FeedbackSessionResponseBody(name='body'),
}

/**
 * @summary 会话反馈
 *
 * @param request FeedbackSessionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return FeedbackSessionResponse
 */
async function feedbackSessionWithOptions(request: FeedbackSessionRequest, runtime: Util.RuntimeOptions): FeedbackSessionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.feedback)) {
    body['Feedback'] = request.feedback;
  }
  if (!Util.isUnset(request.sessionId)) {
    body['SessionId'] = request.sessionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'FeedbackSession',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 会话反馈
 *
 * @param request FeedbackSessionRequest
 * @return FeedbackSessionResponse
 */
async function feedbackSession(request: FeedbackSessionRequest): FeedbackSessionResponse {
  var runtime = new Util.RuntimeOptions{};
  return feedbackSessionWithOptions(request, runtime);
}

model GetAsyncJobResultRequest {
  jobId?: string(name='JobId', description='This parameter is required.', example='7CB9B663-3EF8-4C9C-A464-FDA2B5F1E3A4'),
}

model GetAsyncJobResultResponseBody = {
  data?: {
    errorCode?: string(name='ErrorCode', example='InvalidParameter'),
    errorMessage?: string(name='ErrorMessage', example='paramsIllegal'),
    jobId?: string(name='JobId', example='CCCAAAFB-5628-40DD-A12C-6F52326C1B03'),
    result?: string(name='Result', example='{\\\\"NewProbability\\\\":\\\\"4.062644e-06\\\\",\\\\"NormalProbability\\\\":\\\\"0.7230905\\\\",\\\\"OtherProbability\\\\":\\\\"0.27690542\\\\",\\\\"LesionRatio\\\\":\\\\"0.9387283236994219\\\\",\\\\"Mask\\\\":\\\\"http://algo-app-aic-med-cn-shanghai-prod.oss-cn-shanghai.aliyuncs.com/covid19-dcm/unspecified/2020032702/1b1e1018-6fcf-11ea-8fa1-d20b34387541.nii.gz?Expires=1585276394&OSSAccessKeyId=LTAI4FoLmvQ9urWXgSRp****&Signature=%2F1LNGWJUqvY0VRYGgg8Ldtb3BF****\\\\"}'),
    status?: string(name='Status', example='PROCESS_SUCCESS'),
  }(name='Data'),
  requestId?: string(name='RequestId', example='7CB9B663-3EF8-4C9C-A464-FDA2B5F1E3A4'),
}

model GetAsyncJobResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAsyncJobResultResponseBody(name='body'),
}

/**
 * @param request GetAsyncJobResultRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAsyncJobResultResponse
 */
async function getAsyncJobResultWithOptions(request: GetAsyncJobResultRequest, runtime: Util.RuntimeOptions): GetAsyncJobResultResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.jobId)) {
    body['JobId'] = request.jobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetAsyncJobResult',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request GetAsyncJobResultRequest
 * @return GetAsyncJobResultResponse
 */
async function getAsyncJobResult(request: GetAsyncJobResultRequest): GetAsyncJobResultResponse {
  var runtime = new Util.RuntimeOptions{};
  return getAsyncJobResultWithOptions(request, runtime);
}

model PredictCVDRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  dataSourceType?: string(name='DataSourceType', description='This parameter is required.', example='HTTP_FILES'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  URLList?: [ 
    {
      URL?: string(name='URL', description='This parameter is required.', example='https://medclients-sh.oss-cn-shanghai.aliyuncs.com/demo/xxx/0001.dcm'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model PredictCVDAdvanceRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  dataSourceType?: string(name='DataSourceType', description='This parameter is required.', example='HTTP_FILES'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  URLList?: [ 
    {
      URLObject?: readable(name='URL', description='This parameter is required.', example='https://medclients-sh.oss-cn-shanghai.aliyuncs.com/demo/xxx/0001.dcm'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model PredictCVDResponseBody = {
  data?: {
    lesion?: {
      CVDProbability?: float(name='CVDProbability', example='0.5'),
      featureScore?: {
        aortaCalciumScore?: [ double ](name='AortaCalciumScore'),
        aortaCalciumVolume?: [ double ](name='AortaCalciumVolume'),
        aortaMaxDiam?: [ double ](name='AortaMaxDiam'),
        aortaMaxDiamStd?: [ double ](name='AortaMaxDiamStd'),
        aorticHeightIndex?: [ double ](name='AorticHeightIndex'),
        aorticTortuosityIndex?: [ double ](name='AorticTortuosityIndex'),
        ascAoMaxDiam?: [ double ](name='AscAoMaxDiam'),
        ascendAortaLength?: [ double ](name='AscendAortaLength'),
        cardioThoracicRatio?: [ double ](name='CardioThoracicRatio'),
        chestWidth?: [ double ](name='ChestWidth'),
        coronaryCalciumScore?: [ double ](name='CoronaryCalciumScore'),
        coronaryCalciumVol?: [ double ](name='CoronaryCalciumVol'),
        deepFeature?: [ double ](name='DeepFeature'),
        eatHUMean?: [ double ](name='EatHUMean'),
        eatHUSTD?: [ double ](name='EatHUSTD'),
        eatVolume?: [ double ](name='EatVolume'),
        heartLongDiam?: [ double ](name='HeartLongDiam'),
        heartShortDiam?: [ double ](name='HeartShortDiam'),
        heartWidth?: [ double ](name='HeartWidth'),
        leftLungHighattRatio?: [ double ](name='LeftLungHighattRatio'),
        leftLungLowattRatio?: [ double ](name='LeftLungLowattRatio'),
        myoEpiRatio?: [ double ](name='MyoEpiRatio'),
        rightLungHighattRatio?: [ double ](name='RightLungHighattRatio'),
        rightLungLowattRatio?: [ double ](name='RightLungLowattRatio'),
      }(name='FeatureScore'),
      imagesURL?: string(name='ImagesURL'),
      resultURL?: [ string ](name='ResultURL'),
    }(name='Lesion'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='7CB9B663-3EF8-4C9C-A464-FDA2B5F1E3A4'),
}

model PredictCVDResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PredictCVDResponseBody(name='body'),
}

/**
 * @summary CVD心血管不良事件预测
 *
 * @param request PredictCVDRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return PredictCVDResponse
 */
async function predictCVDWithOptions(request: PredictCVDRequest, runtime: Util.RuntimeOptions): PredictCVDResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.dataFormat)) {
    body['DataFormat'] = request.dataFormat;
  }
  if (!Util.isUnset(request.dataSourceType)) {
    body['DataSourceType'] = request.dataSourceType;
  }
  if (!Util.isUnset(request.orgId)) {
    body['OrgId'] = request.orgId;
  }
  if (!Util.isUnset(request.orgName)) {
    body['OrgName'] = request.orgName;
  }
  if (!Util.isUnset(request.URLList)) {
    body['URLList'] = request.URLList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'PredictCVD',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary CVD心血管不良事件预测
 *
 * @param request PredictCVDRequest
 * @return PredictCVDResponse
 */
async function predictCVD(request: PredictCVDRequest): PredictCVDResponse {
  var runtime = new Util.RuntimeOptions{};
  return predictCVDWithOptions(request, runtime);
}

async function predictCVDAdvance(request: PredictCVDAdvanceRequest, runtime: Util.RuntimeOptions): PredictCVDResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'imageprocess',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var predictCVDReq = new PredictCVDRequest{};
  OpenApiUtil.convert(request, predictCVDReq);

  if(!Util.isUnset(request.URLList)) {
    var i0 : integer = 0;
    for (var item0 : request.URLList) {
      if(!Util.isUnset(item0.URLObject)) {
        authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
        ossConfig.accessKeyId = authResponse.body.accessKeyId;
        ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
        ossClient = new OSS(ossConfig);

        fileObj = new FileForm.FileField{
          filename = authResponse.body.objectKey,
          content = item0.URLObject,
          contentType = '',
        };
        ossHeader = new OSS.PostObjectRequest.header{
          accessKeyId = authResponse.body.accessKeyId,
          policy = authResponse.body.encodedPolicy,
          signature = authResponse.body.signature,
          key = authResponse.body.objectKey,
          file = fileObj,
          successActionStatus = '201',
        };
        uploadRequest = new OSS.PostObjectRequest{
          bucketName = authResponse.body.bucket,
          header = ossHeader,
        };
        ossClient.postObject(uploadRequest, ossRuntime);
        var tmp : PredictCVDRequest.URLList = predictCVDReq.URLList[i0];
        tmp.URL = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
        i0 = Number.ltoi(Number.add(Number.itol(i0), Number.itol(1)));
      }
    }
  }
  var predictCVDResp = predictCVDWithOptions(predictCVDReq, runtime);
  return predictCVDResp;
}

model RunCTRegistrationRequest {
  dataFormat?: string(name='DataFormat', description='DICOM。

This parameter is required.', example='DICOM'),
  dataSourceType?: string(name='DataSourceType', description='This parameter is required.', example='HTTP_FILES'),
  floatingList?: [ 
    {
      floatingURL?: string(name='FloatingURL', description='This parameter is required.', example='https://medclients-sh.oss-cn-shanghai.aliyuncs.com/demo/registration/flt/34_P18.4.1.dcm'),
    }
  ](name='FloatingList', description='This parameter is required.'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  referenceList?: [ 
    {
      referenceURL?: string(name='ReferenceURL', description='This parameter is required.', example='https://medclients-sh.oss-cn-shanghai.aliyuncs.com/demo/registration/ref/33_P18.4.1.dcm'),
    }
  ](name='ReferenceList', description='This parameter is required.'),
}

model RunCTRegistrationAdvanceRequest {
  dataFormat?: string(name='DataFormat', description='DICOM。

This parameter is required.', example='DICOM'),
  dataSourceType?: string(name='DataSourceType', description='This parameter is required.', example='HTTP_FILES'),
  floatingList?: [ 
    {
      floatingURLObject?: readable(name='FloatingURL', description='This parameter is required.', example='https://medclients-sh.oss-cn-shanghai.aliyuncs.com/demo/registration/flt/34_P18.4.1.dcm'),
    }
  ](name='FloatingList', description='This parameter is required.'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  referenceList?: [ 
    {
      referenceURLObject?: readable(name='ReferenceURL', description='This parameter is required.', example='https://medclients-sh.oss-cn-shanghai.aliyuncs.com/demo/registration/ref/33_P18.4.1.dcm'),
    }
  ](name='ReferenceList', description='This parameter is required.'),
}

model RunCTRegistrationResponseBody = {
  data?: {
    DUrl?: string(name='DUrl', example='http://vibktprfx-prod-prod-aic-med-cn-shanghai.oss-cn-shanghai.aliyuncs.com/chest-ct-registration/ctctreg/2020-09-05_13%3A59%3A59_894c42d0-876a-9198-9fd9-09431fb96fad.tar.gz?Expires=1599287399&OSSAccessKeyId=LTAI4FoLmvQ9urWXgSR****&Signature=cWTQtdb7geuEJ46cNO%2BGGimrN****'),
    NUrl?: string(name='NUrl', example='http://vibktprfx-prod-prod-aic-med-cn-shanghai.oss-cn-shanghai.aliyuncs.com/chest-ct-registration/ctctreg/2020-09-05_13%3A59%3A59_894c42d0-876a-9198-9fd9-09431fb96fad.nii.gz?Expires=1599287399&OSSAccessKeyId=LTAI4FoLmvQ9urWXgSR****&Signature=Tgjk1WsZFvvyIUMunxizNtivhY****'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='EB3ACFE6-EA75-49E1-83C0-953580F74D88'),
}

model RunCTRegistrationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RunCTRegistrationResponseBody(name='body'),
}

/**
 * @param request RunCTRegistrationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RunCTRegistrationResponse
 */
async function runCTRegistrationWithOptions(request: RunCTRegistrationRequest, runtime: Util.RuntimeOptions): RunCTRegistrationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.dataFormat)) {
    body['DataFormat'] = request.dataFormat;
  }
  if (!Util.isUnset(request.dataSourceType)) {
    body['DataSourceType'] = request.dataSourceType;
  }
  if (!Util.isUnset(request.floatingList)) {
    body['FloatingList'] = request.floatingList;
  }
  if (!Util.isUnset(request.orgId)) {
    body['OrgId'] = request.orgId;
  }
  if (!Util.isUnset(request.orgName)) {
    body['OrgName'] = request.orgName;
  }
  if (!Util.isUnset(request.referenceList)) {
    body['ReferenceList'] = request.referenceList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RunCTRegistration',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request RunCTRegistrationRequest
 * @return RunCTRegistrationResponse
 */
async function runCTRegistration(request: RunCTRegistrationRequest): RunCTRegistrationResponse {
  var runtime = new Util.RuntimeOptions{};
  return runCTRegistrationWithOptions(request, runtime);
}

async function runCTRegistrationAdvance(request: RunCTRegistrationAdvanceRequest, runtime: Util.RuntimeOptions): RunCTRegistrationResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'imageprocess',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var runCTRegistrationReq = new RunCTRegistrationRequest{};
  OpenApiUtil.convert(request, runCTRegistrationReq);

  if(!Util.isUnset(request.floatingList)) {
    var i0 : integer = 0;
    for (var item0 : request.floatingList) {
      if(!Util.isUnset(item0.floatingURLObject)) {
        authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
        ossConfig.accessKeyId = authResponse.body.accessKeyId;
        ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
        ossClient = new OSS(ossConfig);

        fileObj = new FileForm.FileField{
          filename = authResponse.body.objectKey,
          content = item0.floatingURLObject,
          contentType = '',
        };
        ossHeader = new OSS.PostObjectRequest.header{
          accessKeyId = authResponse.body.accessKeyId,
          policy = authResponse.body.encodedPolicy,
          signature = authResponse.body.signature,
          key = authResponse.body.objectKey,
          file = fileObj,
          successActionStatus = '201',
        };
        uploadRequest = new OSS.PostObjectRequest{
          bucketName = authResponse.body.bucket,
          header = ossHeader,
        };
        ossClient.postObject(uploadRequest, ossRuntime);
        var tmp : RunCTRegistrationRequest.floatingList = runCTRegistrationReq.floatingList[i0];
        tmp.floatingURL = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
        i0 = Number.ltoi(Number.add(Number.itol(i0), Number.itol(1)));
      }
    }
  }
  if(!Util.isUnset(request.referenceList)) {
    var i1 : integer = 0;
    for (var item0 : request.referenceList) {
      if(!Util.isUnset(item0.referenceURLObject)) {
        authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
        ossConfig.accessKeyId = authResponse.body.accessKeyId;
        ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
        ossClient = new OSS(ossConfig);

        fileObj = new FileForm.FileField{
          filename = authResponse.body.objectKey,
          content = item0.referenceURLObject,
          contentType = '',
        };
        ossHeader = new OSS.PostObjectRequest.header{
          accessKeyId = authResponse.body.accessKeyId,
          policy = authResponse.body.encodedPolicy,
          signature = authResponse.body.signature,
          key = authResponse.body.objectKey,
          file = fileObj,
          successActionStatus = '201',
        };
        uploadRequest = new OSS.PostObjectRequest{
          bucketName = authResponse.body.bucket,
          header = ossHeader,
        };
        ossClient.postObject(uploadRequest, ossRuntime);
        var tmp : RunCTRegistrationRequest.referenceList = runCTRegistrationReq.referenceList[i1];
        tmp.referenceURL = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
        i1 = Number.ltoi(Number.add(Number.itol(i1), Number.itol(1)));
      }
    }
  }
  var runCTRegistrationResp = runCTRegistrationWithOptions(runCTRegistrationReq, runtime);
  return runCTRegistrationResp;
}

model RunMedQARequest {
  answerImageDataList?: [ 
    {
      answerImageData?: string(name='AnswerImageData', example='iVBORw0KGgoAAAANSUhEUgAAAoAAAAHJCAIAAACaEB9NAAEAAElEQVR4nNT9Wb****'),
    }
  ](name='AnswerImageDataList'),
  answerImageURLList?: [ 
    {
      answerImageURL?: string(name='AnswerImageURL', example='https://viapi-oss.oss-cn-shanghai.aliyuncs.com/doc/imageprocess/roseola.jpeg'),
    }
  ](name='AnswerImageURLList'),
  answerTextList?: [ 
    {
      answerText?: string(name='AnswerText'),
    }
  ](name='AnswerTextList'),
  department?: string(name='Department', description='This parameter is required.'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='0001'),
  orgName?: string(name='OrgName', description='This parameter is required.', example='weiyi'),
  questionType?: string(name='QuestionType', description='This parameter is required.', example='chiefComplaint'),
  sessionId?: string(name='SessionId', example='d1f6a6c2444f4c01adfadd413938e5c7'),
}

model RunMedQAAdvanceRequest {
  answerImageDataList?: [ 
    {
      answerImageData?: string(name='AnswerImageData', example='iVBORw0KGgoAAAANSUhEUgAAAoAAAAHJCAIAAACaEB9NAAEAAElEQVR4nNT9Wb****'),
    }
  ](name='AnswerImageDataList'),
  answerImageURLList?: [ 
    {
      answerImageURLObject?: readable(name='AnswerImageURL', example='https://viapi-oss.oss-cn-shanghai.aliyuncs.com/doc/imageprocess/roseola.jpeg'),
    }
  ](name='AnswerImageURLList'),
  answerTextList?: [ 
    {
      answerText?: string(name='AnswerText'),
    }
  ](name='AnswerTextList'),
  department?: string(name='Department', description='This parameter is required.'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='0001'),
  orgName?: string(name='OrgName', description='This parameter is required.', example='weiyi'),
  questionType?: string(name='QuestionType', description='This parameter is required.', example='chiefComplaint'),
  sessionId?: string(name='SessionId', example='d1f6a6c2444f4c01adfadd413938e5c7'),
}

model RunMedQAResponseBody = {
  data?: {
    answerType?: string(name='AnswerType', example='text'),
    options?: [ string ](name='Options'),
    question?: string(name='Question'),
    questionType?: string(name='QuestionType', example='age'),
    reports?: map[string]string(name='Reports'),
    sessionId?: string(name='SessionId', example='d1f6a6c2444f4c01adfadd413938e5c7'),
  }(name='Data'),
  requestId?: string(name='RequestId', example='BFF7EEC3-F6B5-4387-AC1D-BB095A1A02E4'),
}

model RunMedQAResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RunMedQAResponseBody(name='body'),
}

/**
 * @param request RunMedQARequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RunMedQAResponse
 */
async function runMedQAWithOptions(request: RunMedQARequest, runtime: Util.RuntimeOptions): RunMedQAResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.answerImageDataList)) {
    body['AnswerImageDataList'] = request.answerImageDataList;
  }
  if (!Util.isUnset(request.answerImageURLList)) {
    body['AnswerImageURLList'] = request.answerImageURLList;
  }
  if (!Util.isUnset(request.answerTextList)) {
    body['AnswerTextList'] = request.answerTextList;
  }
  if (!Util.isUnset(request.department)) {
    body['Department'] = request.department;
  }
  if (!Util.isUnset(request.orgId)) {
    body['OrgId'] = request.orgId;
  }
  if (!Util.isUnset(request.orgName)) {
    body['OrgName'] = request.orgName;
  }
  if (!Util.isUnset(request.questionType)) {
    body['QuestionType'] = request.questionType;
  }
  if (!Util.isUnset(request.sessionId)) {
    body['SessionId'] = request.sessionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RunMedQA',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request RunMedQARequest
 * @return RunMedQAResponse
 */
async function runMedQA(request: RunMedQARequest): RunMedQAResponse {
  var runtime = new Util.RuntimeOptions{};
  return runMedQAWithOptions(request, runtime);
}

async function runMedQAAdvance(request: RunMedQAAdvanceRequest, runtime: Util.RuntimeOptions): RunMedQAResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'imageprocess',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var runMedQAReq = new RunMedQARequest{};
  OpenApiUtil.convert(request, runMedQAReq);

  if(!Util.isUnset(request.answerImageURLList)) {
    var i0 : integer = 0;
    for (var item0 : request.answerImageURLList) {
      if(!Util.isUnset(item0.answerImageURLObject)) {
        authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
        ossConfig.accessKeyId = authResponse.body.accessKeyId;
        ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
        ossClient = new OSS(ossConfig);

        fileObj = new FileForm.FileField{
          filename = authResponse.body.objectKey,
          content = item0.answerImageURLObject,
          contentType = '',
        };
        ossHeader = new OSS.PostObjectRequest.header{
          accessKeyId = authResponse.body.accessKeyId,
          policy = authResponse.body.encodedPolicy,
          signature = authResponse.body.signature,
          key = authResponse.body.objectKey,
          file = fileObj,
          successActionStatus = '201',
        };
        uploadRequest = new OSS.PostObjectRequest{
          bucketName = authResponse.body.bucket,
          header = ossHeader,
        };
        ossClient.postObject(uploadRequest, ossRuntime);
        var tmp : RunMedQARequest.answerImageURLList = runMedQAReq.answerImageURLList[i0];
        tmp.answerImageURL = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
        i0 = Number.ltoi(Number.add(Number.itol(i0), Number.itol(1)));
      }
    }
  }
  var runMedQAResp = runMedQAWithOptions(runMedQAReq, runtime);
  return runMedQAResp;
}

model ScreenCRCRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  dataSourceType?: string(name='DataSourceType', description='This parameter is required.', example='HTTP_FILES'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  URLList?: [ 
    {
      URL?: string(name='URL', description='This parameter is required.', example='https://medclients-sh.oss-cn-shanghai.aliyuncs.com/demo/xxx/0001.dcm'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model ScreenCRCAdvanceRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  dataSourceType?: string(name='DataSourceType', description='This parameter is required.', example='HTTP_FILES'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  URLList?: [ 
    {
      URLObject?: readable(name='URL', description='This parameter is required.', example='https://medclients-sh.oss-cn-shanghai.aliyuncs.com/demo/xxx/0001.dcm'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model ScreenCRCResponseBody = {
  data?: {
    lesion?: {
      CRCVolume?: string(name='CRCVolume', example='7.83'),
      colorectumVolume?: string(name='ColorectumVolume', example='255.93'),
      mask?: string(name='Mask', example='http://vibktprfx-prod-prod-aic-med-cn-shanghai.oss-cn-shanghai.aliyuncs.com/screen_crc/crc_case2_pre.nii.gz?Expires=1680766116&OSSAccessKeyId=LTAI4GC2dJzdf8ZvnC16MFC7&Signature=9n9C%2B2MnyvLwAC%2FwFyxgY********'),
      probabilities?: string(name='Probabilities', example='0.0779, 0.9221'),
    }(name='Lesion'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='39C848F7-D814-1A06-AE0D-AFC706B9700F'),
}

model ScreenCRCResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ScreenCRCResponseBody(name='body'),
}

/**
 * @summary 结直肠癌筛查
 *
 * @param request ScreenCRCRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ScreenCRCResponse
 */
async function screenCRCWithOptions(request: ScreenCRCRequest, runtime: Util.RuntimeOptions): ScreenCRCResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.dataFormat)) {
    body['DataFormat'] = request.dataFormat;
  }
  if (!Util.isUnset(request.dataSourceType)) {
    body['DataSourceType'] = request.dataSourceType;
  }
  if (!Util.isUnset(request.orgId)) {
    body['OrgId'] = request.orgId;
  }
  if (!Util.isUnset(request.orgName)) {
    body['OrgName'] = request.orgName;
  }
  if (!Util.isUnset(request.URLList)) {
    body['URLList'] = request.URLList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ScreenCRC',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 结直肠癌筛查
 *
 * @param request ScreenCRCRequest
 * @return ScreenCRCResponse
 */
async function screenCRC(request: ScreenCRCRequest): ScreenCRCResponse {
  var runtime = new Util.RuntimeOptions{};
  return screenCRCWithOptions(request, runtime);
}

async function screenCRCAdvance(request: ScreenCRCAdvanceRequest, runtime: Util.RuntimeOptions): ScreenCRCResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'imageprocess',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var screenCRCReq = new ScreenCRCRequest{};
  OpenApiUtil.convert(request, screenCRCReq);

  if(!Util.isUnset(request.URLList)) {
    var i0 : integer = 0;
    for (var item0 : request.URLList) {
      if(!Util.isUnset(item0.URLObject)) {
        authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
        ossConfig.accessKeyId = authResponse.body.accessKeyId;
        ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
        ossClient = new OSS(ossConfig);

        fileObj = new FileForm.FileField{
          filename = authResponse.body.objectKey,
          content = item0.URLObject,
          contentType = '',
        };
        ossHeader = new OSS.PostObjectRequest.header{
          accessKeyId = authResponse.body.accessKeyId,
          policy = authResponse.body.encodedPolicy,
          signature = authResponse.body.signature,
          key = authResponse.body.objectKey,
          file = fileObj,
          successActionStatus = '201',
        };
        uploadRequest = new OSS.PostObjectRequest{
          bucketName = authResponse.body.bucket,
          header = ossHeader,
        };
        ossClient.postObject(uploadRequest, ossRuntime);
        var tmp : ScreenCRCRequest.URLList = screenCRCReq.URLList[i0];
        tmp.URL = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
        i0 = Number.ltoi(Number.add(Number.itol(i0), Number.itol(1)));
      }
    }
  }
  var screenCRCResp = screenCRCWithOptions(screenCRCReq, runtime);
  return screenCRCResp;
}

model ScreenChestCTRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  mask?: long(name='Mask', example='4'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.', example='weiyi'),
  URLList?: [ 
    {
      URL?: string(name='URL', description='This parameter is required.', example='https://medclients-sh.oss-cn-shanghai.aliyuncs.com/demo/coronacases_org_001/1.2.112.92121.1.1689.19.2.2020040219072764787101585825****.dcm'),
    }
  ](name='URLList', description='This parameter is required.'),
  verbose?: long(name='Verbose', example='0'),
}

model ScreenChestCTAdvanceRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  mask?: long(name='Mask', example='4'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.', example='weiyi'),
  URLList?: [ 
    {
      URLObject?: readable(name='URL', description='This parameter is required.', example='https://medclients-sh.oss-cn-shanghai.aliyuncs.com/demo/coronacases_org_001/1.2.112.92121.1.1689.19.2.2020040219072764787101585825****.dcm'),
    }
  ](name='URLList', description='This parameter is required.'),
  verbose?: long(name='Verbose', example='0'),
}

model ScreenChestCTResponseBody = {
  data?: {
    analyzeChestVessel?: {
      aortaInfo?: {
        area?: [ float ](name='Area', description='1'),
        coordinates?: [[ float ]        ](name='Coordinates'),
        labelValue?: long(name='LabelValue', example='2'),
        maxArea?: float(name='MaxArea', example='2722'),
        maxAreaIndex?: long(name='MaxAreaIndex', example='416'),
        maxDiameter?: float(name='MaxDiameter', example='63'),
      }(name='AortaInfo'),
      pulmonaryInfo?: {
        area?: [ float ](name='Area', description='1'),
        coordinates?: [[ float ]        ](name='Coordinates'),
        labelValue?: long(name='LabelValue', example='1'),
        maxArea?: float(name='MaxArea', example='928'),
        maxAreaIndex?: long(name='MaxAreaIndex', example='0'),
        maxDiameter?: float(name='MaxDiameter', example='42'),
        nearestAortaArea?: float(name='NearestAortaArea', example='2439'),
      }(name='PulmonaryInfo'),
      resultURL?: string(name='ResultURL', example='http://vibktprfx-prod-prod-aic-med-cn-shanghai.oss-cn-shanghai.aliyuncs.com/ct_artery_aa_ph/local_test/2021-07-08/6C4713DF-F548-47DF-A456-5DA1C8334444_result_compressed.tgz?Expires=1625732732&OSSAccessKeyId=LTAI4FoLmvQ9urWXgSR****&Signature=5UKVmLfM7GWllIcPr9a6dKz%2B5h****'),
    }(name='AnalyzeChestVessel'),
    CACS?: {
      detections?: [ 
        {
          calciumCenter?: [ long ](name='CalciumCenter'),
          calciumId?: long(name='CalciumId', example='1'),
          calciumScore?: float(name='CalciumScore', example='19.22474'),
          calciumVolume?: float(name='CalciumVolume', example='28.837109'),
        }
      ](name='Detections'),
      resultUrl?: string(name='ResultUrl', example='http://vibktprfx-prod-prod-aic-med-cn-shanghai.oss-cn-shanghai.aliyuncs.com/calc-cacs/2020-09-29/2020-09-29-11%3A07%3A41-D74FE0DF-8F80-41EB-B08B-2E67053587EC.tar.gz?Expires=1601350661&OSSAccessKeyId=LTAI4FoLmvQ9urWXgSRp****&Signature=iB16ms28Y5mzB11ghYUd7upCi4****'),
      score?: string(name='Score', example='4.83'),
      seriesInstanceUID?: string(name='SeriesInstanceUID', example='1.2.392.489642.9116.2.6.1.44063.1986736248.1658817546.650139'),
      volumeScore?: string(name='VolumeScore', example='111.96'),
    }(name='CACS'),
    calcBMD?: {
      detections?: [ 
        {
          vertBMD?: float(name='VertBMD'),
          vertCategory?: float(name='VertCategory'),
          vertId?: string(name='VertId'),
          vertTScore?: float(name='VertTScore'),
          vertZScore?: float(name='VertZScore'),
        }
      ](name='Detections'),
      origin?: [ float ](name='Origin'),
      resultURL?: string(name='ResultURL'),
      seriesInstanceUid?: string(name='SeriesInstanceUid'),
      spacing?: [ float ](name='Spacing'),
    }(name='CalcBMD'),
    covid?: {
      lesionRatio?: string(name='LesionRatio', example='0.9387283236994219'),
      mask?: string(name='Mask', example='http://algo-app-aic-med-cn-shanghai-prod.oss-cn-shanghai.aliyuncs.com/covid19-dcm/unspecified/2020032702/1b1e1018-6fcf-11ea-8fa1-d20b34387541.nii.gz?Expires=1585276394&OSSAccessKeyId=LTAI4FoLmvQ9urWXgSRp****&Signature=%2F1LNGWJUqvY0VRYGgg8Ldtb3BF****'),
      newProbability?: string(name='NewProbability', example='4.062644e-06'),
      normalProbability?: string(name='NormalProbability', example='0.7230905'),
      otherProbability?: string(name='OtherProbability', example='0.27690542'),
      seriesInstanceUID?: string(name='SeriesInstanceUID', example='1.2.392.200036.9116.2.6.1.44063.1805049129.1658817546.650139'),
    }(name='Covid'),
    detectAD?: {
      distanceMap?: string(name='DistanceMap'),
      mask?: string(name='Mask'),
      possibility?: string(name='Possibility'),
      seriesInstanceUid?: string(name='SeriesInstanceUid'),
      sliceVal?: int32(name='SliceVal'),
    }(name='DetectAD'),
    detectLiverSteatosis?: {
      detections?: [ 
        {
          fatFract?: double(name='FatFract'),
          liverHU?: float(name='LiverHU'),
          liverROI1?: float(name='LiverROI1'),
          liverROI2?: float(name='LiverROI2'),
          liverROI3?: float(name='LiverROI3'),
          liverSlice?: float(name='LiverSlice'),
          liverSpleenDifference?: float(name='LiverSpleenDifference'),
          liverSpleenRatio?: float(name='LiverSpleenRatio'),
          liverVolume?: float(name='LiverVolume'),
          maossScore?: double(name='MaossScore'),
          prediction?: string(name='Prediction'),
          probability?: float(name='Probability'),
          ROI1Center?: [ long ](name='ROI1Center'),
          ROI2Center?: [ long ](name='ROI2Center'),
          ROI3Center?: [ long ](name='ROI3Center'),
          radius?: long(name='Radius'),
          spleenCenter?: [ long ](name='SpleenCenter'),
          spleenHU?: float(name='SpleenHU'),
          spleenROI?: float(name='SpleenROI'),
          spleenSlice?: float(name='SpleenSlice'),
          spleenVolume?: float(name='SpleenVolume'),
        }
      ](name='Detections'),
      origin?: [ float ](name='Origin'),
      resultUrl?: string(name='ResultUrl'),
      seriesInstanceUid?: string(name='SeriesInstanceUid'),
      spacing?: [ float ](name='Spacing'),
    }(name='DetectLiverSteatosis'),
    detectLymph?: {
      lesions?: [ 
        {
          boxes?: [ float ](name='Boxes'),
          diametermm?: [ float ](name='Diametermm'),
          keySlice?: long(name='KeySlice', example='7'),
          recist?: [[ float ]          ](name='Recist'),
          score?: float(name='Score', example='0.6298'),
        }
      ](name='Lesions'),
      seriesInstanceUID?: string(name='SeriesInstanceUID', example='1.2.568.200036.9116.2.6.1.44063.1805049129.1357480934.650139'),
    }(name='DetectLymph'),
    detectPdac?: {
      lesion?: {
        lesionList?: [ 
          {
            diameter?: [ float ](name='Diameter'),
            keySlice?: int32(name='KeySlice'),
            ROIEndpoints?: [[ int32 ]            ](name='ROIEndpoints'),
            recistEndpoints?: [[ int32 ]            ](name='RecistEndpoints'),
            type?: string(name='Type'),
          }
        ](name='LesionList'),
        mask?: string(name='Mask', example='http://vibktprfx-prod-prod-aic-med-cn-shanghai.oss-cn-shanghai.aliyuncs.com/screen-pdac/2022-05-25_14%3A33%3A30/4CA2BF25-BCDB-9C6C-B14C-EB41E8266588.nii.gz?Expires=1653462210&OSSAccessKeyId=LTAI4FoLmvQ9urWXgSR****&Signature=8t%2FknUrQyyyCU2p7QhMC%2BXBCR****'),
        nonPdacVol?: string(name='NonPdacVol', example='0'),
        organList?: [ 
          {
            diameter?: [ float ](name='Diameter'),
            keySlice?: int32(name='KeySlice'),
            ROIEndpoints?: [[ int32 ]            ](name='ROIEndpoints'),
            recistEndpoints?: [[ int32 ]            ](name='RecistEndpoints'),
            type?: string(name='Type'),
          }
        ](name='OrganList'),
        pancVol?: string(name='PancVol', example='0'),
        pdacVol?: string(name='PdacVol', example='0'),
        possibilities?: [ string ](name='Possibilities'),
      }(name='Lesion'),
      seriesInstanceUID?: string(name='SeriesInstanceUID', example='1.2.239.200036.9116.2.6.1.44063.1805049129.1357480934.650139'),
    }(name='DetectPdac'),
    detectRibFracture?: {
      detections?: [ 
        {
          coordinateImage?: [ long ](name='CoordinateImage'),
          coordinates?: [ long ](name='Coordinates'),
          fracSOPInstanceUID?: string(name='FracSOPInstanceUID'),
          fractureCategory?: long(name='FractureCategory', example='1'),
          fractureConfidence?: float(name='FractureConfidence', example='0.7916666666666667'),
          fractureId?: long(name='FractureId', example='2'),
          fractureLocation?: string(name='FractureLocation', example='L4'),
          fractureSegment?: long(name='FractureSegment', example='0'),
        }
      ](name='Detections'),
      fractureMaskURL?: string(name='FractureMaskURL', example='http://vibktprfx-prod-prod-aic-med-cn-shanghai.oss-cn-shanghai.aliyuncs.com/screen-chest-ct/detect-rib-fracture/2022-07-27/2022-07-27-15_15_39-8BBD1C28-383A-548F-AD7D-CB5E0ABA207D_be6ffcb2d2e9494cba8112e07f93f466_ribFracture-mask.nii.gz?Expires=1659165340&OSSAccessKeyId=LTAI4FoLmvQ9urWXgSR****&Signature=2lzFDLfGbhVXsHm%2BKhgpglWmA****'),
      origin?: [ float ](name='Origin'),
      resultURL?: string(name='ResultURL', example='http://vibktprfx-prod-prod-aic-med-cn-shanghai.oss-cn-shanghai.aliyuncs.com/detect-rib-fracture/local_test/2020-12-22/result-D5CD101C-F8E5-43CA-9E99-44C783B8F8BE.tar.gz?Expires=1608631727&OSSAccessKeyId=LTAI4FoLmvQ9urWXgSRp****&Signature=d6c32E1IB4b7Ayo1lpjs%2Bq3Ylv****'),
      ribSegmentMaskURL?: string(name='RibSegmentMaskURL', example='http://vibktprfx-prod-prod-aic-med-cn-shanghai.oss-cn-shanghai.aliyuncs.com/screen-chest-ct/detect-rib-fracture/2022-07-27/2022-07-27-15_15_39-8BBD1C28-383A-548F-AD7D-CB5E0ABA207D_be6ffcb2d2e9494cba8112e07f93f466_ribFracture-ribmask.nii.gz?Expires=1659165340&OSSAccessKeyId=LTAI4FoLmvQ9urWXgSR****&Signature=5Z%2FCS3B%2B%2Ff6nlBk7alY39LvH3****'),
      seriesInstanceUID?: string(name='SeriesInstanceUID', example='1.2.392.489642.9116.2.6.1.78361.1298784213.1658817546.650139'),
      spacing?: [ float ](name='Spacing'),
    }(name='DetectRibFracture'),
    errorMessage?: string(name='ErrorMessage', example='Failed to execute [cacs,covid]'),
    lungNodule?: {
      series?: [ 
        {
          elements?: [ 
            {
              category?: string(name='Category', example='1'),
              confidence?: float(name='Confidence', example='0.7012705768508907'),
              diameter?: float(name='Diameter', example='9.730626493692398'),
              imageX?: float(name='ImageX', example='308.9676976455463'),
              imageY?: float(name='ImageY', example='198.3552282631497'),
              imageZ?: float(name='ImageZ', example='198.3552282631497'),
              lobe?: string(name='Lobe', example='up'),
              lung?: string(name='Lung', example='left'),
              majorAxis?: [ float ](name='MajorAxis'),
              meanValue?: float(name='MeanValue', example='261.37589112119247'),
              minorAxis?: [ float ](name='MinorAxis'),
              recistSOPInstanceUID?: string(name='RecistSOPInstanceUID'),
              risk?: float(name='Risk'),
              SOPInstanceUID?: string(name='SOPInstanceUID', example='1.3.6.1.4.1.14519.5.2.1.6279.6001.261151233960269013402330853013'),
              volume?: float(name='Volume', example='10959.220491175074'),
              x?: float(name='X', example='51.24291240631416'),
              y?: float(name='Y', example='-32.23147700784307'),
              z?: float(name='Z', example='-46.81608170781766'),
            }
          ](name='Elements'),
          origin?: [ float ](name='Origin'),
          report?: string(name='Report'),
          seriesInstanceUid?: string(name='SeriesInstanceUid', example='1.3.6.1.4.1.14519.5.2.1.6279.6001.179049373636438705059720603192'),
          spacing?: [ float ](name='Spacing'),
        }
      ](name='Series'),
    }(name='LungNodule'),
    muscleFat?: {
      FAT_TYPE?: int32(name='FAT_TYPE'),
      MASK_PATH?: string(name='MASK_PATH'),
      MUSCLE_MASS?: int32(name='MUSCLE_MASS'),
      MUSCLE_QUALITY?: int32(name='MUSCLE_QUALITY'),
      NAMA_TAMA_INDEX_TSCORE?: float(name='NAMA_TAMA_INDEX_TSCORE'),
      PERCENT_IMAT?: float(name='PERCENT_IMAT'),
      PERCENT_LAMA?: float(name='PERCENT_LAMA'),
      PERCENT_NAMA?: float(name='PERCENT_NAMA'),
      RENDERING_PATH?: string(name='RENDERING_PATH'),
      SFA?: float(name='SFA'),
      SFT?: float(name='SFT'),
      SMA?: float(name='SMA'),
      SMI?: float(name='SMI'),
      STUDY_AGE?: int32(name='STUDY_AGE'),
      STUDY_GENDER?: string(name='STUDY_GENDER'),
      seriesInstanceUid?: string(name='SeriesInstanceUid'),
      VERTEBRA_IN_USE?: float(name='VERTEBRA_IN_USE'),
      VFA?: float(name='VFA'),
    }(name='MuscleFat'),
    nestedUrlList?: map[string]any(name='NestedUrlList', example='https://medclients-sh.oss-cn-shanghai.aliyuncs.com/demo/coronacases_org_001/1.2.112.92121.1.1689.19.2.2020040219072764787101585825****.dcm'),
    predictCVD?: {
      lesion?: {
        CVDProbability?: double(name='CVDProbability'),
        featureScore?: {
          aortaCalciumScore?: [ double ](name='AortaCalciumScore'),
          aortaCalciumVolume?: [ double ](name='AortaCalciumVolume'),
          aortaMaxDiam?: [ double ](name='AortaMaxDiam'),
          aortaMaxDiamStd?: [ double ](name='AortaMaxDiamStd'),
          aorticHeightIndex?: [ double ](name='AorticHeightIndex'),
          aorticTortuosityIndex?: [ double ](name='AorticTortuosityIndex'),
          ascAoMaxDiam?: [ double ](name='AscAoMaxDiam'),
          ascendAortaLength?: [ double ](name='AscendAortaLength'),
          cardioThoracicRatio?: [ double ](name='CardioThoracicRatio'),
          chestWidth?: [ double ](name='ChestWidth'),
          coronaryCalciumScore?: [ double ](name='CoronaryCalciumScore'),
          coronaryCalciumVol?: [ double ](name='CoronaryCalciumVol'),
          deepFeature?: [ double ](name='DeepFeature'),
          eatHUMean?: [ double ](name='EatHUMean'),
          eatHUSTD?: [ double ](name='EatHUSTD'),
          eatVolume?: [ double ](name='EatVolume'),
          heartLongDiam?: [ double ](name='HeartLongDiam'),
          heartShortDiam?: [ double ](name='HeartShortDiam'),
          heartWidth?: [ double ](name='HeartWidth'),
          leftLungHighattRatio?: [ double ](name='LeftLungHighattRatio'),
          leftLungLowattRatio?: [ double ](name='LeftLungLowattRatio'),
          myoEpiRatio?: [ double ](name='MyoEpiRatio'),
          rightLungHighattRatio?: [ double ](name='RightLungHighattRatio'),
          rightLungLowattRatio?: [ double ](name='RightLungLowattRatio'),
        }(name='FeatureScore'),
        imagesURL?: string(name='ImagesURL'),
        resultURL?: [ string ](name='ResultURL'),
      }(name='Lesion'),
      seriesInstanceUid?: string(name='SeriesInstanceUid'),
    }(name='PredictCVD'),
    screenBC?: {
      lesion?: {
        left?: {
          BCVolume?: string(name='BCVolume'),
          breastVolume?: string(name='BreastVolume'),
          probabilities?: [ string ](name='Probabilities'),
        }(name='Left'),
        lesionList?: [ 
          {
            diameter?: [ float ](name='Diameter'),
            keySlice?: int32(name='KeySlice'),
            ROIEndpoints?: [[ int32 ]            ](name='ROIEndpoints'),
            recistEndpoints?: [[ int32 ]            ](name='RecistEndpoints'),
            type?: string(name='Type'),
          }
        ](name='LesionList'),
        mask?: string(name='Mask'),
        organList?: [ 
          {
            diameter?: [ float ](name='Diameter'),
            keySlice?: int32(name='KeySlice'),
            ROIEndpoints?: [[ int32 ]            ](name='ROIEndpoints'),
            recistEndpoints?: [[ int32 ]            ](name='RecistEndpoints'),
            type?: string(name='Type'),
          }
        ](name='OrganList'),
        right?: {
          BCVolume?: string(name='BCVolume'),
          breastVolume?: string(name='BreastVolume'),
          probabilities?: [ string ](name='Probabilities'),
        }(name='Right'),
      }(name='Lesion'),
      seriesInstanceUid?: string(name='SeriesInstanceUid'),
    }(name='ScreenBC'),
    screenCRC?: {
      lesion?: {
        colorectumVolume?: string(name='ColorectumVolume'),
        lesionList?: [ 
          {
            diameter?: [ float ](name='Diameter'),
            keySlice?: int32(name='KeySlice'),
            ROIEndpoints?: [[ int32 ]            ](name='ROIEndpoints'),
            recistEndpoints?: [[ int32 ]            ](name='RecistEndpoints'),
            type?: string(name='Type'),
          }
        ](name='LesionList'),
        mask?: string(name='Mask'),
        organList?: [ 
          {
            diameter?: [ float ](name='Diameter'),
            keySlice?: int32(name='KeySlice'),
            ROIEndpoints?: [[ int32 ]            ](name='ROIEndpoints'),
            recistEndpoints?: [[ int32 ]            ](name='RecistEndpoints'),
            type?: string(name='Type'),
          }
        ](name='OrganList'),
        probabilities?: [ string ](name='Probabilities'),
      }(name='Lesion'),
      seriesInstanceUid?: string(name='SeriesInstanceUid'),
    }(name='ScreenCRC'),
    screenEc?: {
      lesion?: {
        benignVolume?: string(name='BenignVolume'),
        ecVolume?: string(name='EcVolume'),
        egjVolume?: string(name='EgjVolume'),
        esoVolume?: string(name='EsoVolume'),
        lesionList?: [ 
          {
            diameter?: [ float ](name='Diameter'),
            keySlice?: int32(name='KeySlice'),
            ROIEndpoints?: [[ int32 ]            ](name='ROIEndpoints'),
            recistEndpoints?: [[ int32 ]            ](name='RecistEndpoints'),
            type?: string(name='Type'),
          }
        ](name='LesionList'),
        mask?: string(name='Mask'),
        organList?: [ 
          {
            diameter?: [ float ](name='Diameter'),
            keySlice?: int32(name='KeySlice'),
            ROIEndpoints?: [[ int32 ]            ](name='ROIEndpoints'),
            recistEndpoints?: [[ int32 ]            ](name='RecistEndpoints'),
            type?: string(name='Type'),
          }
        ](name='OrganList'),
        possibilities?: [ string ](name='Possibilities'),
      }(name='Lesion'),
      seriesInstanceUid?: string(name='SeriesInstanceUid'),
    }(name='ScreenEc'),
    screenGC?: {
      lesion?: {
        GCVolume?: string(name='GCVolume'),
        lesionList?: [ 
          {
            diameter?: [ float ](name='Diameter'),
            keySlice?: int32(name='KeySlice'),
            ROIEndpoints?: [[ int32 ]            ](name='ROIEndpoints'),
            recistEndpoints?: [[ int32 ]            ](name='RecistEndpoints'),
            type?: string(name='Type'),
          }
        ](name='LesionList'),
        mask?: string(name='Mask'),
        nonGCVolume?: string(name='NonGCVolume'),
        organList?: [ 
          {
            diameter?: [ float ](name='Diameter'),
            keySlice?: int32(name='KeySlice'),
            ROIEndpoints?: [[ int32 ]            ](name='ROIEndpoints'),
            recistEndpoints?: [[ int32 ]            ](name='RecistEndpoints'),
            type?: string(name='Type'),
          }
        ](name='OrganList'),
        probabilities?: [ string ](name='Probabilities'),
        stomachVolume?: string(name='StomachVolume'),
      }(name='Lesion'),
      seriesInstanceUid?: string(name='SeriesInstanceUid'),
    }(name='ScreenGC'),
    screenLC?: {
      lesion?: {
        lesionList?: [ 
          {
            diameter?: [ float ](name='Diameter'),
            keySlice?: long(name='KeySlice'),
            malignancy?: float(name='Malignancy'),
            recistEndpoints?: [ float ](name='RecistEndpoints'),
            type?: string(name='Type'),
            volume?: float(name='Volume'),
          }
        ](name='LesionList'),
        liverVolume?: string(name='LiverVolume'),
        mask?: string(name='Mask'),
        patientLevelResult?: {
          benignNonCystProb?: string(name='BenignNonCystProb'),
          cystProb?: string(name='CystProb'),
          HCCProb?: string(name='HCCProb'),
          malignantNonHCCProb?: string(name='MalignantNonHCCProb'),
        }(name='PatientLevelResult'),
      }(name='Lesion'),
      seriesInstanceUid?: string(name='SeriesInstanceUid'),
    }(name='ScreenLC'),
    URLList?: map[string]any(name='URLList', example='https://medclients-sh.oss-cn-shanghai.aliyuncs.com/demo/coronacases_org_001/1.2.112.92121.1.1689.19.2.2020040219072764787101585825****.dcm'),
  }(name='Data'),
  message?: string(name='Message', example='imageUrl download failed'),
  requestId?: string(name='RequestId', example='528B54D4-3AAB-47CF-B6CE-0C2A2FB4C7C2'),
}

model ScreenChestCTResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ScreenChestCTResponseBody(name='body'),
}

/**
 * @summary 胸部CT平扫
 *
 * @param request ScreenChestCTRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ScreenChestCTResponse
 */
async function screenChestCTWithOptions(request: ScreenChestCTRequest, runtime: Util.RuntimeOptions): ScreenChestCTResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.dataFormat)) {
    body['DataFormat'] = request.dataFormat;
  }
  if (!Util.isUnset(request.mask)) {
    body['Mask'] = request.mask;
  }
  if (!Util.isUnset(request.orgId)) {
    body['OrgId'] = request.orgId;
  }
  if (!Util.isUnset(request.orgName)) {
    body['OrgName'] = request.orgName;
  }
  if (!Util.isUnset(request.URLList)) {
    body['URLList'] = request.URLList;
  }
  if (!Util.isUnset(request.verbose)) {
    body['Verbose'] = request.verbose;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ScreenChestCT',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 胸部CT平扫
 *
 * @param request ScreenChestCTRequest
 * @return ScreenChestCTResponse
 */
async function screenChestCT(request: ScreenChestCTRequest): ScreenChestCTResponse {
  var runtime = new Util.RuntimeOptions{};
  return screenChestCTWithOptions(request, runtime);
}

async function screenChestCTAdvance(request: ScreenChestCTAdvanceRequest, runtime: Util.RuntimeOptions): ScreenChestCTResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'imageprocess',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var screenChestCTReq = new ScreenChestCTRequest{};
  OpenApiUtil.convert(request, screenChestCTReq);

  if(!Util.isUnset(request.URLList)) {
    var i0 : integer = 0;
    for (var item0 : request.URLList) {
      if(!Util.isUnset(item0.URLObject)) {
        authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
        ossConfig.accessKeyId = authResponse.body.accessKeyId;
        ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
        ossClient = new OSS(ossConfig);

        fileObj = new FileForm.FileField{
          filename = authResponse.body.objectKey,
          content = item0.URLObject,
          contentType = '',
        };
        ossHeader = new OSS.PostObjectRequest.header{
          accessKeyId = authResponse.body.accessKeyId,
          policy = authResponse.body.encodedPolicy,
          signature = authResponse.body.signature,
          key = authResponse.body.objectKey,
          file = fileObj,
          successActionStatus = '201',
        };
        uploadRequest = new OSS.PostObjectRequest{
          bucketName = authResponse.body.bucket,
          header = ossHeader,
        };
        ossClient.postObject(uploadRequest, ossRuntime);
        var tmp : ScreenChestCTRequest.URLList = screenChestCTReq.URLList[i0];
        tmp.URL = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
        i0 = Number.ltoi(Number.add(Number.itol(i0), Number.itol(1)));
      }
    }
  }
  var screenChestCTResp = screenChestCTWithOptions(screenChestCTReq, runtime);
  return screenChestCTResp;
}

model ScreenECRequest {
  dataSourceType?: string(name='DataSourceType', description='This parameter is required.', example='HTTP_FILES'),
  URLList?: [ 
    {
      URL?: string(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model ScreenECAdvanceRequest {
  dataSourceType?: string(name='DataSourceType', description='This parameter is required.', example='HTTP_FILES'),
  URLList?: [ 
    {
      URLObject?: readable(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model ScreenECResponseBody = {
  data?: {
    lesion?: {
      benignVolume?: string(name='BenignVolume', example='0'),
      ecVolume?: string(name='EcVolume', example='0'),
      esoVolume?: string(name='EsoVolume', example='26814'),
      mask?: string(name='Mask', example='http://vibktprfx-prod-prod-aic-med-cn-shanghai.oss-cn-shanghai.aliyuncs.com/screen-pdac/2022-05-25_14%3A33%3A30/4CA2BF25-BCDB-9C6C-B14C-EB41E8266588.nii.gz?Expires=1653462210&OSSAccessKeyId=LTAI4FoLmvQ9urWXgSR****&Signature=8t%2FknUrQyyyCU2p7QhMC%2BXBCR****'),
      possibilities?: [ string ](name='Possibilities'),
    }(name='Lesion'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='9B65AC8E-311A-1ED1-BBE6-6AA6D35D31A6'),
}

model ScreenECResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ScreenECResponseBody(name='body'),
}

/**
 * @summary 食管癌筛查
 *
 * @param request ScreenECRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ScreenECResponse
 */
async function screenECWithOptions(request: ScreenECRequest, runtime: Util.RuntimeOptions): ScreenECResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.dataSourceType)) {
    body['DataSourceType'] = request.dataSourceType;
  }
  if (!Util.isUnset(request.URLList)) {
    body['URLList'] = request.URLList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ScreenEC',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 食管癌筛查
 *
 * @param request ScreenECRequest
 * @return ScreenECResponse
 */
async function screenEC(request: ScreenECRequest): ScreenECResponse {
  var runtime = new Util.RuntimeOptions{};
  return screenECWithOptions(request, runtime);
}

async function screenECAdvance(request: ScreenECAdvanceRequest, runtime: Util.RuntimeOptions): ScreenECResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'imageprocess',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var screenECReq = new ScreenECRequest{};
  OpenApiUtil.convert(request, screenECReq);

  if(!Util.isUnset(request.URLList)) {
    var i0 : integer = 0;
    for (var item0 : request.URLList) {
      if(!Util.isUnset(item0.URLObject)) {
        authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
        ossConfig.accessKeyId = authResponse.body.accessKeyId;
        ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
        ossClient = new OSS(ossConfig);

        fileObj = new FileForm.FileField{
          filename = authResponse.body.objectKey,
          content = item0.URLObject,
          contentType = '',
        };
        ossHeader = new OSS.PostObjectRequest.header{
          accessKeyId = authResponse.body.accessKeyId,
          policy = authResponse.body.encodedPolicy,
          signature = authResponse.body.signature,
          key = authResponse.body.objectKey,
          file = fileObj,
          successActionStatus = '201',
        };
        uploadRequest = new OSS.PostObjectRequest{
          bucketName = authResponse.body.bucket,
          header = ossHeader,
        };
        ossClient.postObject(uploadRequest, ossRuntime);
        var tmp : ScreenECRequest.URLList = screenECReq.URLList[i0];
        tmp.URL = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
        i0 = Number.ltoi(Number.add(Number.itol(i0), Number.itol(1)));
      }
    }
  }
  var screenECResp = screenECWithOptions(screenECReq, runtime);
  return screenECResp;
}

model ScreenGCRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  dataSourceType?: string(name='DataSourceType', description='This parameter is required.', example='HTTP_FILES'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  URLList?: [ 
    {
      URL?: string(name='URL', description='This parameter is required.', example='https://medclients-sh.oss-cn-shanghai.aliyuncs.com/demo/xxx/0001.dcm'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model ScreenGCAdvanceRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  dataSourceType?: string(name='DataSourceType', description='This parameter is required.', example='HTTP_FILES'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  URLList?: [ 
    {
      URLObject?: readable(name='URL', description='This parameter is required.', example='https://medclients-sh.oss-cn-shanghai.aliyuncs.com/demo/xxx/0001.dcm'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model ScreenGCResponseBody = {
  data?: {
    lesion?: {
      GCVolume?: string(name='GCVolume', example='5.86'),
      mask?: string(name='Mask', example='http://vibktprfx-prod-prod-aic-med-cn-shanghai.oss-cn-shanghai.aliyuncs.com/screen_gc/gc_11949981_stomach.nii.gz?Expires=1680678697&OSSAccessKeyId=LTAI4GC2dJzdf8ZvnC16****&Signature=EpKCTEPipWO0AiB3Uip85c%2BuMg****'),
      nonGCVolume?: string(name='NonGCVolume', example='0.00'),
      probabilities?: string(name='Probabilities', example='["0.1467", "0.8533", "0.0000"]'),
      stomachVolume?: string(name='StomachVolume', example='508.79'),
    }(name='Lesion'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='9B65AC8E-311A-1ED1-BBE6-6AA6D35D31A6'),
}

model ScreenGCResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ScreenGCResponseBody(name='body'),
}

/**
 * @summary 胃癌筛查
 *
 * @param request ScreenGCRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ScreenGCResponse
 */
async function screenGCWithOptions(request: ScreenGCRequest, runtime: Util.RuntimeOptions): ScreenGCResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.dataFormat)) {
    body['DataFormat'] = request.dataFormat;
  }
  if (!Util.isUnset(request.dataSourceType)) {
    body['DataSourceType'] = request.dataSourceType;
  }
  if (!Util.isUnset(request.orgId)) {
    body['OrgId'] = request.orgId;
  }
  if (!Util.isUnset(request.orgName)) {
    body['OrgName'] = request.orgName;
  }
  if (!Util.isUnset(request.URLList)) {
    body['URLList'] = request.URLList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ScreenGC',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 胃癌筛查
 *
 * @param request ScreenGCRequest
 * @return ScreenGCResponse
 */
async function screenGC(request: ScreenGCRequest): ScreenGCResponse {
  var runtime = new Util.RuntimeOptions{};
  return screenGCWithOptions(request, runtime);
}

async function screenGCAdvance(request: ScreenGCAdvanceRequest, runtime: Util.RuntimeOptions): ScreenGCResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'imageprocess',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var screenGCReq = new ScreenGCRequest{};
  OpenApiUtil.convert(request, screenGCReq);

  if(!Util.isUnset(request.URLList)) {
    var i0 : integer = 0;
    for (var item0 : request.URLList) {
      if(!Util.isUnset(item0.URLObject)) {
        authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
        ossConfig.accessKeyId = authResponse.body.accessKeyId;
        ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
        ossClient = new OSS(ossConfig);

        fileObj = new FileForm.FileField{
          filename = authResponse.body.objectKey,
          content = item0.URLObject,
          contentType = '',
        };
        ossHeader = new OSS.PostObjectRequest.header{
          accessKeyId = authResponse.body.accessKeyId,
          policy = authResponse.body.encodedPolicy,
          signature = authResponse.body.signature,
          key = authResponse.body.objectKey,
          file = fileObj,
          successActionStatus = '201',
        };
        uploadRequest = new OSS.PostObjectRequest{
          bucketName = authResponse.body.bucket,
          header = ossHeader,
        };
        ossClient.postObject(uploadRequest, ossRuntime);
        var tmp : ScreenGCRequest.URLList = screenGCReq.URLList[i0];
        tmp.URL = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
        i0 = Number.ltoi(Number.add(Number.itol(i0), Number.itol(1)));
      }
    }
  }
  var screenGCResp = screenGCWithOptions(screenGCReq, runtime);
  return screenGCResp;
}

model ScreenLCRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  dataSourceType?: string(name='DataSourceType', description='This parameter is required.', example='HTTP_FILES'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  URLList?: [ 
    {
      URL?: string(name='URL', description='This parameter is required.', example='https://medclients-sh.oss-cn-shanghai.aliyuncs.com/demo/xxx/0001.dcm'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model ScreenLCAdvanceRequest {
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  dataSourceType?: string(name='DataSourceType', description='This parameter is required.', example='HTTP_FILES'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  URLList?: [ 
    {
      URLObject?: readable(name='URL', description='This parameter is required.', example='https://medclients-sh.oss-cn-shanghai.aliyuncs.com/demo/xxx/0001.dcm'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model ScreenLCResponseBody = {
  data?: {
    lesion?: {
      lesionList?: [ 
        {
          diameter?: [ float ](name='Diameter'),
          keySlice?: long(name='KeySlice', example='100'),
          malignancy?: float(name='Malignancy', example='0.9375'),
          recistEndpoints?: [ float ](name='RecistEndpoints'),
          type?: string(name='Type', example='HCC'),
          volume?: float(name='Volume', example='305.3661'),
        }
      ](name='LesionList'),
      liverVolume?: float(name='LiverVolume', example='1364.9468'),
      mask?: string(name='Mask', example='20-050_0000.nii.gz'),
      patientLevelResult?: {
        benignNonCystProb?: string(name='BenignNonCystProb', example='0.0077'),
        cystProb?: float(name='CystProb', example='0.9233'),
        HCCProb?: float(name='HCCProb', example='0.9941'),
        malignantNonHCCProb?: float(name='MalignantNonHCCProb', example='0.0073'),
      }(name='PatientLevelResult'),
    }(name='Lesion'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='473dbfb0-9cb7-e18e-450b-e4d0e4ce6c1c'),
}

model ScreenLCResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ScreenLCResponseBody(name='body'),
}

/**
 * @summary 肝癌筛查
 *
 * @param request ScreenLCRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ScreenLCResponse
 */
async function screenLCWithOptions(request: ScreenLCRequest, runtime: Util.RuntimeOptions): ScreenLCResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.dataFormat)) {
    body['DataFormat'] = request.dataFormat;
  }
  if (!Util.isUnset(request.dataSourceType)) {
    body['DataSourceType'] = request.dataSourceType;
  }
  if (!Util.isUnset(request.orgId)) {
    body['OrgId'] = request.orgId;
  }
  if (!Util.isUnset(request.orgName)) {
    body['OrgName'] = request.orgName;
  }
  if (!Util.isUnset(request.URLList)) {
    body['URLList'] = request.URLList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ScreenLC',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 肝癌筛查
 *
 * @param request ScreenLCRequest
 * @return ScreenLCResponse
 */
async function screenLC(request: ScreenLCRequest): ScreenLCResponse {
  var runtime = new Util.RuntimeOptions{};
  return screenLCWithOptions(request, runtime);
}

async function screenLCAdvance(request: ScreenLCAdvanceRequest, runtime: Util.RuntimeOptions): ScreenLCResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'imageprocess',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var screenLCReq = new ScreenLCRequest{};
  OpenApiUtil.convert(request, screenLCReq);

  if(!Util.isUnset(request.URLList)) {
    var i0 : integer = 0;
    for (var item0 : request.URLList) {
      if(!Util.isUnset(item0.URLObject)) {
        authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
        ossConfig.accessKeyId = authResponse.body.accessKeyId;
        ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
        ossClient = new OSS(ossConfig);

        fileObj = new FileForm.FileField{
          filename = authResponse.body.objectKey,
          content = item0.URLObject,
          contentType = '',
        };
        ossHeader = new OSS.PostObjectRequest.header{
          accessKeyId = authResponse.body.accessKeyId,
          policy = authResponse.body.encodedPolicy,
          signature = authResponse.body.signature,
          key = authResponse.body.objectKey,
          file = fileObj,
          successActionStatus = '201',
        };
        uploadRequest = new OSS.PostObjectRequest{
          bucketName = authResponse.body.bucket,
          header = ossHeader,
        };
        ossClient.postObject(uploadRequest, ossRuntime);
        var tmp : ScreenLCRequest.URLList = screenLCReq.URLList[i0];
        tmp.URL = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
        i0 = Number.ltoi(Number.add(Number.itol(i0), Number.itol(1)));
      }
    }
  }
  var screenLCResp = screenLCWithOptions(screenLCReq, runtime);
  return screenLCResp;
}

model SegmentLymphNodeRequest {
  bodyPart?: string(name='BodyPart', description='This parameter is required.', example='CHEST'),
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='1'),
  orgName?: string(name='OrgName', description='This parameter is required.', example='1'),
  URLList?: [ 
    {
      URL?: string(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model SegmentLymphNodeAdvanceRequest {
  bodyPart?: string(name='BodyPart', description='This parameter is required.', example='CHEST'),
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='1'),
  orgName?: string(name='OrgName', description='This parameter is required.', example='1'),
  URLList?: [ 
    {
      URLObject?: readable(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model SegmentLymphNodeResponseBody = {
  data?: {
    resultURL?: string(name='ResultURL', example='http://vibktprfx-prod-prod-med-eas-cn-shanghai.oss-cn-shanghai.aliyuncs.com/seg-organ-ct/2023-03-06/18%3A03%3A28/286574099408093190.nii.gz?Expires=1678098808&OSSAccessKeyId=LTAI4FoLmvQ9urWXgSRp****&Signature=jsPwP7rg4orZQFC6USE3JUOJcS****'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='B48DECE6-29FE-1967-92F1-2E072873851A'),
}

model SegmentLymphNodeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SegmentLymphNodeResponseBody(name='body'),
}

/**
 * @summary 放疗淋巴站分割
 *
 * @param request SegmentLymphNodeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SegmentLymphNodeResponse
 */
async function segmentLymphNodeWithOptions(request: SegmentLymphNodeRequest, runtime: Util.RuntimeOptions): SegmentLymphNodeResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.bodyPart)) {
    body['BodyPart'] = request.bodyPart;
  }
  if (!Util.isUnset(request.dataFormat)) {
    body['DataFormat'] = request.dataFormat;
  }
  if (!Util.isUnset(request.orgId)) {
    body['OrgId'] = request.orgId;
  }
  if (!Util.isUnset(request.orgName)) {
    body['OrgName'] = request.orgName;
  }
  if (!Util.isUnset(request.URLList)) {
    body['URLList'] = request.URLList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SegmentLymphNode',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 放疗淋巴站分割
 *
 * @param request SegmentLymphNodeRequest
 * @return SegmentLymphNodeResponse
 */
async function segmentLymphNode(request: SegmentLymphNodeRequest): SegmentLymphNodeResponse {
  var runtime = new Util.RuntimeOptions{};
  return segmentLymphNodeWithOptions(request, runtime);
}

async function segmentLymphNodeAdvance(request: SegmentLymphNodeAdvanceRequest, runtime: Util.RuntimeOptions): SegmentLymphNodeResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'imageprocess',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var segmentLymphNodeReq = new SegmentLymphNodeRequest{};
  OpenApiUtil.convert(request, segmentLymphNodeReq);

  if(!Util.isUnset(request.URLList)) {
    var i0 : integer = 0;
    for (var item0 : request.URLList) {
      if(!Util.isUnset(item0.URLObject)) {
        authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
        ossConfig.accessKeyId = authResponse.body.accessKeyId;
        ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
        ossClient = new OSS(ossConfig);

        fileObj = new FileForm.FileField{
          filename = authResponse.body.objectKey,
          content = item0.URLObject,
          contentType = '',
        };
        ossHeader = new OSS.PostObjectRequest.header{
          accessKeyId = authResponse.body.accessKeyId,
          policy = authResponse.body.encodedPolicy,
          signature = authResponse.body.signature,
          key = authResponse.body.objectKey,
          file = fileObj,
          successActionStatus = '201',
        };
        uploadRequest = new OSS.PostObjectRequest{
          bucketName = authResponse.body.bucket,
          header = ossHeader,
        };
        ossClient.postObject(uploadRequest, ossRuntime);
        var tmp : SegmentLymphNodeRequest.URLList = segmentLymphNodeReq.URLList[i0];
        tmp.URL = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
        i0 = Number.ltoi(Number.add(Number.itol(i0), Number.itol(1)));
      }
    }
  }
  var segmentLymphNodeResp = segmentLymphNodeWithOptions(segmentLymphNodeReq, runtime);
  return segmentLymphNodeResp;
}

model SegmentOARRequest {
  bodyPart?: string(name='BodyPart', example='CHEST'),
  contrast?: boolean(name='Contrast', example='true'),
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='NIFTI'),
  maskList?: [ long ](name='MaskList'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  URLList?: [ 
    {
      URL?: string(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model SegmentOARAdvanceRequest {
  bodyPart?: string(name='BodyPart', example='CHEST'),
  contrast?: boolean(name='Contrast', example='true'),
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='NIFTI'),
  maskList?: [ long ](name='MaskList'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='7ff51bfe-e73d-11ea-827d-506b4b3f3cf6'),
  orgName?: string(name='OrgName', description='This parameter is required.'),
  URLList?: [ 
    {
      URLObject?: readable(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model SegmentOARResponseBody = {
  data?: {
    maskList?: [ string ](name='MaskList'),
    resultURL?: string(name='ResultURL', example='http://vibktprfx-prod-prod-aic-med-cn-shanghai.oss-cn-shanghai.aliyuncs.com/calc-cacs/2020-09-29/2020-09-29-11%3A07%3A41-D74FE0DF-8F80-41EB-B08B-2E67053587EC.tar.gz?Expires=1601350661&OSSAccessKeyId=LTAI4FoLmvQ9urWXgSRp****&Signature=iB16ms28Y5mzB11ghYUd7upCi4****'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='57784EDF-7322-1559-89C2-26A08570B26B'),
}

model SegmentOARResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SegmentOARResponseBody(name='body'),
}

/**
 * @summary 多器官分割
 *
 * @param request SegmentOARRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SegmentOARResponse
 */
async function segmentOARWithOptions(request: SegmentOARRequest, runtime: Util.RuntimeOptions): SegmentOARResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.bodyPart)) {
    body['BodyPart'] = request.bodyPart;
  }
  if (!Util.isUnset(request.contrast)) {
    body['Contrast'] = request.contrast;
  }
  if (!Util.isUnset(request.dataFormat)) {
    body['DataFormat'] = request.dataFormat;
  }
  if (!Util.isUnset(request.maskList)) {
    body['MaskList'] = request.maskList;
  }
  if (!Util.isUnset(request.orgId)) {
    body['OrgId'] = request.orgId;
  }
  if (!Util.isUnset(request.orgName)) {
    body['OrgName'] = request.orgName;
  }
  if (!Util.isUnset(request.URLList)) {
    body['URLList'] = request.URLList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SegmentOAR',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 多器官分割
 *
 * @param request SegmentOARRequest
 * @return SegmentOARResponse
 */
async function segmentOAR(request: SegmentOARRequest): SegmentOARResponse {
  var runtime = new Util.RuntimeOptions{};
  return segmentOARWithOptions(request, runtime);
}

async function segmentOARAdvance(request: SegmentOARAdvanceRequest, runtime: Util.RuntimeOptions): SegmentOARResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'imageprocess',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var segmentOARReq = new SegmentOARRequest{};
  OpenApiUtil.convert(request, segmentOARReq);

  if(!Util.isUnset(request.URLList)) {
    var i0 : integer = 0;
    for (var item0 : request.URLList) {
      if(!Util.isUnset(item0.URLObject)) {
        authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
        ossConfig.accessKeyId = authResponse.body.accessKeyId;
        ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
        ossClient = new OSS(ossConfig);

        fileObj = new FileForm.FileField{
          filename = authResponse.body.objectKey,
          content = item0.URLObject,
          contentType = '',
        };
        ossHeader = new OSS.PostObjectRequest.header{
          accessKeyId = authResponse.body.accessKeyId,
          policy = authResponse.body.encodedPolicy,
          signature = authResponse.body.signature,
          key = authResponse.body.objectKey,
          file = fileObj,
          successActionStatus = '201',
        };
        uploadRequest = new OSS.PostObjectRequest{
          bucketName = authResponse.body.bucket,
          header = ossHeader,
        };
        ossClient.postObject(uploadRequest, ossRuntime);
        var tmp : SegmentOARRequest.URLList = segmentOARReq.URLList[i0];
        tmp.URL = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
        i0 = Number.ltoi(Number.add(Number.itol(i0), Number.itol(1)));
      }
    }
  }
  var segmentOARResp = segmentOARWithOptions(segmentOARReq, runtime);
  return segmentOARResp;
}

model TargetVolumeSegmentRequest {
  cancerType?: string(name='CancerType', description='This parameter is required.', example='LUNG'),
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='1'),
  orgName?: string(name='OrgName', description='This parameter is required.', example='1'),
  targetVolumeType?: string(name='TargetVolumeType', description='This parameter is required.', example='GTV'),
  URLList?: [ 
    {
      URL?: string(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model TargetVolumeSegmentAdvanceRequest {
  cancerType?: string(name='CancerType', description='This parameter is required.', example='LUNG'),
  dataFormat?: string(name='DataFormat', description='This parameter is required.', example='DICOM'),
  orgId?: string(name='OrgId', description='This parameter is required.', example='1'),
  orgName?: string(name='OrgName', description='This parameter is required.', example='1'),
  targetVolumeType?: string(name='TargetVolumeType', description='This parameter is required.', example='GTV'),
  URLList?: [ 
    {
      URLObject?: readable(name='URL', description='This parameter is required.'),
    }
  ](name='URLList', description='This parameter is required.'),
}

model TargetVolumeSegmentResponseBody = {
  data?: {
    resultURL?: string(name='ResultURL', example='http://vibktprfx-prod-prod-med-eas-cn-shanghai.oss-cn-shanghai.aliyuncs.com/seg-organ-ct/2023-01-31/13%3A59%3A57/286304994262646784.nii.gz?Expires=1675146629&amp;OSSAccessKeyId=LTAI4FoLmvQ9urWXgSRp****&amp;Signature=L7jGtdydjfaFxQQCwqe4q4hlHz****'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='6cc7232e-d38b-4dda-b86d-6e0e31704fa1'),
}

model TargetVolumeSegmentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: TargetVolumeSegmentResponseBody(name='body'),
}

/**
 * @summary 放疗靶区勾画算法
 *
 * @param request TargetVolumeSegmentRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return TargetVolumeSegmentResponse
 */
async function targetVolumeSegmentWithOptions(request: TargetVolumeSegmentRequest, runtime: Util.RuntimeOptions): TargetVolumeSegmentResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.cancerType)) {
    body['CancerType'] = request.cancerType;
  }
  if (!Util.isUnset(request.dataFormat)) {
    body['DataFormat'] = request.dataFormat;
  }
  if (!Util.isUnset(request.orgId)) {
    body['OrgId'] = request.orgId;
  }
  if (!Util.isUnset(request.orgName)) {
    body['OrgName'] = request.orgName;
  }
  if (!Util.isUnset(request.targetVolumeType)) {
    body['TargetVolumeType'] = request.targetVolumeType;
  }
  if (!Util.isUnset(request.URLList)) {
    body['URLList'] = request.URLList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'TargetVolumeSegment',
    version = '2020-03-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 放疗靶区勾画算法
 *
 * @param request TargetVolumeSegmentRequest
 * @return TargetVolumeSegmentResponse
 */
async function targetVolumeSegment(request: TargetVolumeSegmentRequest): TargetVolumeSegmentResponse {
  var runtime = new Util.RuntimeOptions{};
  return targetVolumeSegmentWithOptions(request, runtime);
}

async function targetVolumeSegmentAdvance(request: TargetVolumeSegmentAdvanceRequest, runtime: Util.RuntimeOptions): TargetVolumeSegmentResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'imageprocess',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var targetVolumeSegmentReq = new TargetVolumeSegmentRequest{};
  OpenApiUtil.convert(request, targetVolumeSegmentReq);

  if(!Util.isUnset(request.URLList)) {
    var i0 : integer = 0;
    for (var item0 : request.URLList) {
      if(!Util.isUnset(item0.URLObject)) {
        authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
        ossConfig.accessKeyId = authResponse.body.accessKeyId;
        ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
        ossClient = new OSS(ossConfig);

        fileObj = new FileForm.FileField{
          filename = authResponse.body.objectKey,
          content = item0.URLObject,
          contentType = '',
        };
        ossHeader = new OSS.PostObjectRequest.header{
          accessKeyId = authResponse.body.accessKeyId,
          policy = authResponse.body.encodedPolicy,
          signature = authResponse.body.signature,
          key = authResponse.body.objectKey,
          file = fileObj,
          successActionStatus = '201',
        };
        uploadRequest = new OSS.PostObjectRequest{
          bucketName = authResponse.body.bucket,
          header = ossHeader,
        };
        ossClient.postObject(uploadRequest, ossRuntime);
        var tmp : TargetVolumeSegmentRequest.URLList = targetVolumeSegmentReq.URLList[i0];
        tmp.URL = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
        i0 = Number.ltoi(Number.add(Number.itol(i0), Number.itol(1)));
      }
    }
  }
  var targetVolumeSegmentResp = targetVolumeSegmentWithOptions(targetVolumeSegmentReq, runtime);
  return targetVolumeSegmentResp;
}

